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

Liquid phase volume fraction

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 19, 2008, 12:48
Default Hello. Is it possible to ca
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Hello.

Is it possible to calculate the liquid phase volume fraction of one of two individual regions containing the same fluid?

I'm simulation a nucleate-boiling case and need some information about the bubble volume after it has detached from the base.



Of course I can't use the information from the interFoam Solver because the lpvf given by the solver itself contains both areas ...

Any ideas?
Thanks in advance...
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   June 20, 2008, 05:10
Default Hi Sebastian Well it is kin
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Sebastian

Well it is kind of a hack, but what about searching along the boundary patch to the left.

You go from the bottom and note when the phase the first time to from air to water, and then note when it goes from water to air. You take the average of these two y-coordinates, and then you have a lower limit for your liquid phase volume. Kind of this:

scalar phaseFraction(0), volumePart(0);
forAll(gamma,gI)
{
if(mesh.C()[gI].component(1) > lowerLimit)
{
volumePart += mesh[gI].V();
phaseFraction += mesh[gI].V() * gamma[gI];
}
}
Info << "Phase fraction: " << phaseFraction / volumePart << endl;

Have a nice weekend,
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 24, 2008, 04:48
Default Hello Niels. Thanks for you
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Hello Niels.

Thanks for your answer.
I have thought about it some time, but I don't understand, how this can work.

If I have a information containing an average of two y-coordinates I still don't have information about volumes?

And as a matter of fact I'm totally unfamiliar with the code you have posted. Am I guessing right, that I have to put this directly into my interFoam solver?

Maybe some further information:
I'm searching for the volume of the detached (the upper) bubble. Does you code calculate for the upper or lower bubble volume? And what happens if there are more than two?

Greetings.
Sebastian
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   June 24, 2008, 04:57
Default Just for fun: Here is a video
  #4
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Just for fun:
Here is a video of the nucleate boiling case

http://therealsega.th.funpic.de/openfoam/nb.mpg

(Static contact angle, constant flow regime)
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   June 24, 2008, 05:36
Default Hi Sebastian I can see from
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Sebastian

I can see from your movie that your system i somewhat more complex than I thought. But still, the main features can still be used.

lowerLimit:= the average defined as above.
upperLimit:= above the first detached bubble.

1:> scalar phaseFraction(0), volumePart(0);
2:> forAll(gamma,gI)
3:> {
4:> if(mesh.C()[gI].component(1) > lowerLimit && mesh.C()[gI].component(1) < upperLimit)
5:> {
6:> volumePart += mesh[gI].V();
7:> phaseFraction += mesh[gI].V() * gamma[gI];
8:> }
9:> }
10:> Info << "Phase fraction: " << phaseFraction / volumePart << endl;

In line 2 you loop over all elements in gamma.
In line 4 you see if the coordinat of that cells is within the upper and lower limits.
In line 6 the volume of the cell is added to "volumePart" if the cell is within the limits.
In line 7 the volume of air/water is added to phaseFraction. If this is precisely identical to volumePart the phaseFraction / volumePart will become 1.
On the other hand, you will be able to find volume of bubbles by
(1 - phaseFraction / volumeFraction) * volumeFraction.

Just insert is directly into interFoam, it should work as soon as you have upperLimit and lowerLimit.

Nice movie, btw.

/ Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 24, 2008, 06:06
Default Ok, Thanks. I will have a l
  #6
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Ok, Thanks.

I will have a look into it.

First question: Is it possible to calculate this outside of the interFoam solver?
As a post processing tool?

I want to skip the 4 hours calculation ...
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   June 24, 2008, 06:49
Default The question would be yes. Loo
  #7
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
The question would be yes. Look here and be inspired:

~/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing

/ Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 25, 2008, 11:28
Default Thanks for your help so far.
  #8
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Thanks for your help so far.

But there are some severe problems compiling your code.
I have put your code into a C-File from another post-processing tool I used to calculate the barycenter.

I think there are some problems with the dependencies of the C-File.
But I really don't have an idea, which files I need, and which I don't.

Furter there seems to be some wrong coding, because there are several errors with the brackets ( and { respectively } and ) ...

Is it possible, that you have a look over the code.
First of all, this is the error code:

sega@M1530:~/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing/liquidPhaseVolu meFraction$ wmake Making dependency list for source file liquidPhaseVolumeFraction.C
could not open file createFields.H for source file liquidPhaseVolumeFraction.C
SOURCE=liquidPhaseVolumeFraction.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/incompressible/lnInclud e -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/interfaceProperties/lnI nclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/liquidPhaseVolumeFraction.o
liquidPhaseVolumeFraction.C:52:29: error: createFields.H: No such file or directory In file included from /home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/setInitialDeltaT.H :36,
from liquidPhaseVolumeFraction.C:55:
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/CourantNo.H: In function 'int main(int, char**)':
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/CourantNo.H:39: error: 'phi' was not declared in this scope
liquidPhaseVolumeFraction.C:61: error: request for member 'size' in 'gamma', which is of non-class type 'double ()(double)throw ()'
liquidPhaseVolumeFraction.C:63: error: 'lowerLimit' was not declared in this scope
liquidPhaseVolumeFraction.C:64: error: expected `)' before '{' token
liquidPhaseVolumeFraction.C:68: error: expected primary-expression before '}' token
liquidPhaseVolumeFraction.C:68: error: expected `;' before '}' token
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/readPISOControls.H :3: warning: unused variable 'nCorr'
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/initContinuityErrs .H:38: warning: unused variable 'cumulativeContErr'
make: *** [Make/linuxGccDPOpt/liquidPhaseVolumeFraction.o] Fehler 1

http://therealsega.funpic.de/openfoa...raction.tar.gz
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   June 25, 2008, 15:42
Default 1. You have not copy-pasted th
  #9
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
1. You have not copy-pasted the entire expression, i.e. ')'-errors. Thus please check your own work, before you call it "wrong coding".
2. createFields.H is utility-specific, thus is needs to be present in the same folder.
3. You have neither defined upperLimit or lowerLimit.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   July 1, 2008, 10:03
Default Hello again. I have looked
  #10
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Hello again.

I have looked into it another time.
Its still not working due to my poor C++ experience, but I know now how it should be.

I would like to go back to the first message from Niels:
You go from the bottom and note when the phase the first time from air to water, and then note when it goes from water to air. You take the average of these two y-coordinates, and then you have a lower limit for your liquid phase volume

Is it possible to do this automatically?
Or do I have to specify the lower directly inside the code by measuring in any way (e.g. with a ruler and a plot)?

I think this will not work automatically for every timestep. I thought about calculating this for a single timestep I chose. For example any timestep where the bubble is below the upper limit.

How can I tell the tool to just calculate for a singe timestep directory?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 2, 2008, 05:19
Default Hi > Is it possible to do t
  #11
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi

> Is it possible to do this automatically?
Yes, indeed, but you will run into problems if the upper bubble is concave and in the inner of the domain extend below the limit defined at the boundary.

> How can I tell the tool to just calculate for a singe timestep directory?
E.g. reconstructPar has a option called -time where you can specify a specific time. Look into that and be inspired.

/ Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   July 2, 2008, 07:03
Default Ok, I put together some rough
  #12
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Ok, I put together some rough code.
At least the bracket-errors are solved.

liquidPhaseVolumeFraction.C

Leaving the upper and lower limit aside (will get to it later) I get this message when compiling the code:

Making dependency list for source file liquidPhaseVolumeFraction.C
SOURCE=liquidPhaseVolumeFraction.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/incompressible/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/interfaceProperties/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/liquidPhaseVolumeFraction.o
liquidPhaseVolumeFraction.C: In function 'int main(int, char**)':
liquidPhaseVolumeFraction.C:68: error: request for member 'operator[]' is ambiguous
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/dictionary.H:209: error: candidates are: Foam::ITstream& Foam::dictionary::operator[](const Foam::word&) const
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/dictionary.H:209: error: Foam::ITstream& Foam::dictionary::operator[](const Foam::word&) const
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/HashTableI.H:84: error: const T& Foam::HashTable<t,>::operator[](const Key&) const [with T = Foam::regIOobject*, Key = Foam::word, Hash = Foam::string::hash]
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/HashTableI.H:68: error: T& Foam::HashTable<t,>::operator[](const Key&) [with T = Foam::regIOobject*, Key = Foam::word, Hash = Foam::string::hash]
liquidPhaseVolumeFraction.C:69: error: request for member 'operator[]' is ambiguous
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/dictionary.H:209: error: candidates are: Foam::ITstream& Foam::dictionary::operator[](const Foam::word&) const
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/dictionary.H:209: error: Foam::ITstream& Foam::dictionary::operator[](const Foam::word&) const
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/HashTableI.H:84: error: const T& Foam::HashTable<t,>::operator[](const Key&) const [with T = Foam::regIOobject*, Key = Foam::word, Hash = Foam::string::hash]
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/HashTableI.H:68: error: T& Foam::HashTable<t,>::operator[](const Key&) [with T = Foam::regIOobject*, Key = Foam::word, Hash = Foam::string::hash]
/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/readPISOControls.H:3: warning: unused variable 'nCorr'
make: *** [Make/linuxGccDPOpt/liquidPhaseVolumeFraction.o] Fehler 1

Whats wrong with this operator[] ?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 2, 2008, 07:27
Default Sorry. mesh.V() should read
  #13
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Sorry.

mesh[gI].V() should read mesh.V()[gI].

/ Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   July 2, 2008, 14:10
Default Hello. Thank you Niels, the
  #14
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Hello.

Thank you Niels, the tool is compiling now!

I had a look into the reconstructPar.C file.
Well, I can't get anything useful out of it, sorry.
From my experiences with the parabolic inlet files I have guessed that the input-options (like time in this case) are read from the shell using some kind of
argList::validOptions or argList::validArgs statement. I cant find anything in reconstructPar.C that looks similar.

So, I think I need some further information about how to read a time option from the shell, and how to get the code work only on this special time-directory.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 3, 2008, 04:48
Default Well, suggested reconstructPar
  #15
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Well, suggested reconstructPar because I know you can specify a specific time.
The argList is like the way to go, thus find a utility which allows you to use a specific time. If you call a utility without any options, then you get a list of possible options. I believe that would be the fastest way to find what you are looking for.

/ Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   July 14, 2008, 07:42
Default Well I'm still stuck with this
  #16
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Well I'm still stuck with this.

Is there a possibility to do this with ParaView?
Extracting part of the computational domain by upper and lower limits and calculating the phase fraction on this cut?

I have toyed around with the filters but found no satisfying solution ...
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 15, 2008, 08:23
Default Ok, back to the code. I'm s
  #17
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Ok, back to the code.

I'm still not getting how to read a time option and to make the code work at a specific time directory.

There are so many tools using time options but I just don't know which code snipped is responsible for it.

I thought its about reading from the argList, but none of the tools reads the time option from the argList ...
Some tools do something with runTime or setTime, others use checkTimeOptions.H which is cryptic to me as well.

So, can anybody help?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 15, 2008, 08:44
Default Okay Sebastian If you for i
  #18
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,608
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Okay Sebastian

If you for instance take the wallGradU function, to be found in:

OpenFOAM/OpenFOAM-1.4.1/applications/utilities/postProcessing/wall/wallGradU

remove everything from inside the time-loop which is application specific, then you will have a framework in which you will be able to do what you want, e.g. only solving the bubble size for one specific time step.

/ Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   August 7, 2008, 08:25
Default Ok, I will try this. Is thi
  #19
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Ok, I will try this.

Is this the time loop?

for (label i=startTime; i<endTime; i++)
{
}

Greetings. S.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 7, 2008, 08:35
Default So I did copy my stuff into th
  #20
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
So I did copy my stuff into the timeloop and get this

lpvf.C

...and some errors about classes and functions:

Making dependency list for source file lpvf.C
SOURCE=lpvf.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/incompressible/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/transportModels/interfaceProperties/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/lpvf.o
lpvf.C: In function 'int main(int, char**)':
lpvf.C:68: error: request for member 'size' in 'gamma', which is of non-class type 'double ()(double)throw ()'
lpvf.C:74: error: pointer to a function used in arithmetic
lpvf.C:74: error: invalid operands of types 'const double' and 'double ()(double)' to binary 'operator*'
make: *** [Make/linuxGccDPOpt/lpvf.o] Fehler 1

So, where is the problem now?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi phase Volume fraction at inlet F S CFX 1 April 11, 2011 21:08
need references for Liquid-liquid two-phase flow qunwuhe@hotmail.com Main CFD Forum 1 December 8, 2009 04:32
How to set volume fraction in two phase flow Kamel FLUENT 2 March 23, 2007 01:06
How set volume fraction and species mass fraction Reginaldo Cotto FLUENT 0 August 31, 2006 04:58
Time-averaged phase volume fraction dlaw FLUENT 5 August 3, 2005 13:33


All times are GMT -4. The time now is 17:49.