CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to compute surface area of rising bubble (https://www.cfd-online.com/Forums/openfoam/107991-how-compute-surface-area-rising-bubble.html)

Nazanin January 10, 2014 08:52

Quote:

Originally Posted by Andrea_85 (Post 469457)
Hi all,

i guess that the total interfacial area can be simply calculated using:

\Sum_i=1:N \grad\alpha_i * \deltaV_i

where N is total numer of cells in your domain. This gives you an area in m^2, so if your case is 2-D and you just need the lenght of the interfacial line you have to normalized by the thickness.

This is consistent with the CSF method implemented in interFoam.

Best

andrea

Thank you very much for reply andrea..
Do you know how I can determine changing bubble diameter during run and relative velocity??
Best

Andrea_85 January 10, 2014 09:06

Hi,

supposing that your bubble remains a sphere (or circle in 2-D) and does not deform then if you have the surface area you can calculate the radius(diameter) using area formulas

2-D -> 2*Pi*R = surfaceArea/thickness
3-D -> 4*Pi*R^2 = surfaceArea

and what do you mean with "relative velocity"? Is it the mean rising velocity?
If yes, you can for example calculate the mean velocity of the center of mass which gives you the mean velocity of the rising bubble.

best

andrea

Nazanin January 10, 2014 09:17

1 Attachment(s)
Quote:

Originally Posted by Andrea_85 (Post 469464)
Hi,

supposing that your bubble remains a sphere (or circle in 2-D) and does not deform then if you have the surface area you can calculate the radius(diameter) using area formulas

2-D -> 2*Pi*R = surfaceArea/thickness
3-D -> 4*Pi*R^2 = surfaceArea

and what do you mean with "relative velocity"? Is it the mean rising velocity?
If yes, you can for example calculate the mean velocity of the center of mass which gives you the mean velocity of the rising bubble.

best

andrea

Thank you very much.
If I want use your idea,should I writing code for my solver or I can use swak4foam?
relative velocity means:
that Ux Uy Uz is bubble velocty and Ul is local liquid velocity...

Andrea_85 January 10, 2014 09:36

It depends what you want to do with diameter and velocity. Do you need them during the simulation, because for example they appear in some new equations you are solving or you just need them in the post-processing?

Nazanin January 10, 2014 09:44

Quote:

Originally Posted by Andrea_85 (Post 469468)
It depends what you want to do with diameter and velocity. Do you need them during the simulation, because for example they appear in some new equations you are solving or you just need them in the post-processing?

I want plot these parameters after simulation (post-prosessing) ..
I found in swak4Foam examples (capilaryRise-test case) that use simpleSwakFunctionObjects and swakFunctionObjects for compute some parameters like this but I dont know how determine for my case study??

Andrea_85 January 12, 2014 05:12

Hi,

i think the best would be write your own script that does all the calculations. Have a look in application/utilities/postprocessing.
There you have a lot of examples. You can modify the main part of one of those to read the correct quantities and print what you need.


best
andrea

gschaider January 22, 2014 19:14

Quote:

Originally Posted by Nazanin (Post 469469)
I want plot these parameters after simulation (post-prosessing) ..
I found in swak4Foam examples (capilaryRise-test case) that use simpleSwakFunctionObjects and swakFunctionObjects for compute some parameters like this but I dont know how determine for my case study??

I'm still unsure what the actual problem is:
- you have already done the simulation and want to do the calculation on the data on disc: funkyDoCalc might help you there (it can do all the things swakExpression can do)
- or you want to use swakExpression and are unclear about the actual expressions to use?

raunakbardia March 13, 2015 14:59

Thanks a lot.

I needed an approximate and I was trying to implement a lot of different techniques to get the surface area but swak did the trick easily.

hojjat.m June 23, 2015 14:54

Normal vector at the interface
 
Hello Foamers;
I am using interFoam, and I was wondering if there is anyway that we can access to the normal vector at the interface. I mean I want to have the normal vector in my results. Any feedback is appreciated :)

Andrea_85 June 23, 2015 18:05

The interface unit normal vector is defined as:

n = grad(alpha)/mag(grad(alpha))

In interfaceProperties.C it is calculated at the face centres at line 125

surfaceVectorField nHatfv(gradAlphaf/(mag(gradAlphaf) + deltaN_));

(deltaN is just a correction to avoid division by zero).

To print the vectors i would add a constructor in interfaceProperties.C (also modify interfaceProperties.H accordingly) with the declaration of nHatfv (something similar to what you find for the other variables).
Then you can call it in the main code using

interface.nHatfv()

Hope this help

Andrea

hojjat.m June 24, 2015 12:13

Andrea,

Thanks for the reply, I went the procedure you had mentioned and I get this error:
from my_interFoam.C:43:
/home/magma/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/interfaceProperties/lnInclude/interfaceProperties.H:129:9: error: ‘const surfaceVectorField& Foam::interfaceProperties::nHatfv() const’ conflicts with a previous declaration
/home/magma/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/interfaceProperties/lnInclude/interfaceProperties.H:73:21: note: previous declaration ‘Foam::surfaceVectorField Foam::interfaceProperties::nHatfv’
/home/magma/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/interfaceProperties/lnInclude/interfaceProperties.H: In member function ‘const surfaceVectorField& Foam::interfaceProperties::nHatfv() const’:
/home/magma/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/interfaceProperties/lnInclude/interfaceProperties.H:128:20: error: invalid initialization of reference of type ‘const surfaceVectorField& {aka const Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>&}’ from expression of type ‘<unresolved overloaded function type>’
my_interFoam.C: In function ‘int main(int, char**)’:
my_interFoam.C:106:3: error: ‘interface’ was not declared in this scope

hojjat.m June 24, 2015 12:14

But I think the main problem is the following error:

‘interface’ was not declared in this scope

Andrea_85 June 24, 2015 13:13

Did you compile the library (interfaceProperties) after implementing the changes?


anyway you have two errors...try to post here the changes you did

Best,
Andrea

hojjat.m June 24, 2015 13:27

Andrea,
You were right, I hadn't compiled it, now that I have compiled it, when I add

interface.nHatfv();

I get the following error again:

error: ‘interface’ was not declared in this scope


This is the only error I get, is it because of the version that I am using, I am using openFoam 2.3.x

Andrea_85 June 24, 2015 13:40

try with

mixture.nHatfv();

hojjat.m June 24, 2015 13:50

Actually, I had tried this, but I get this error:

In file included from /home/magma/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude/immiscibleIncompressibleTwoPhaseMixture.H:39:0,
from my_interFoam.C:43:
/home/magma/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/interfaceProperties/lnInclude/interfaceProperties.H: In function ‘int main(int, char**)’:
/home/magma/OpenFOAM/OpenFOAM-2.3.1/src/transportModels/interfaceProperties/lnInclude/interfaceProperties.H:73:28: error: ‘Foam::surfaceVectorField Foam::interfaceProperties::nHatfv’ is private
my_interFoam.C:109:10: error: within this context
my_interFoam.C:109:17: error: no match for call to ‘(Foam::surfaceVectorField {aka Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>}) ()’


I mean it works for mixture.nHatf(), but not for mixture.nHatfv()
But nHatf=nHatfv.sf is the surfaceScalar field, not the one that we want :(

Andrea_85 June 25, 2015 05:18

I tried with OF 2.1 and it works. This is what i have done:

1) in interfaceProperties.C
- removed the declaration of nHatfv
- add

nHatfv_ = gradAlphaf/(mag(gradAlphaf) + deltaN_);
correctContactAngle(nHatfv_.boundaryField(), gradAlphaf.boundaryField()); //just add "_"

// Face unit interface normal flux
nHatf_ = nHatfv_ & Sf; //Just add "_"

---------------
- In "Constructors" add (after the declaration of nHatf_)
nHatfv_
(
IOobject
(
"nHatfv",
U_.time().timeName(),
U_.mesh()
),
U_.mesh(),
dimensionedVector("nHatfv", dimless, vector::zero)
),
----------------------

2) in interfaceProperties.H

-add (after the declaration of nHatf_)
surfaceVectorField nHatfv_;

-in "Member Function" add (after the declaration of nHatf_)
const surfaceVectorField& nHatfv() const
{
return nHatfv_;
}

--------------


3) Re-compile interfaceProperties with "wmake libso"

4) in interFoam.C add

surfaceVectorField n = interface.nHatfv(); //(here you probably have to change "interface" with "mixture")
n.write();

5) Re-compile interFoam with "wmake"


I tried right now and it works, i am not 100% sure that the correction for the contact angle at wall is taken into account when you write nHatfv(), you may want to check this.

Best,
Andrea

hojjat.m June 25, 2015 10:00

Andrea,
Thank you very much for the response, I tried the procedure that you had mentioned, and it compiles perfectly, but when I enter interFoam to start the simulations, I get the following error:


--> FOAM FATAL ERROR:
Different dimensions for =
dimensions : [0 2 0 0 0 0 0] = [0 0 0 0 0 0 0]


From function dimensionSet::operator=(const dimensionSet&) const
in file dimensionSet/dimensionSet.C at line 171.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) in "/home/magma/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/magma/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 Foam::dimensionSet::operator=(Foam::dimensionSet const&) const in "/home/magma/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#3 Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>::operator=(Foam::tmp<Foam::Geom etricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh> > const&) in "/home/magma/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib/libinterfaceProperties.so"
#4 Foam::interfaceProperties::calculateK() in "/home/magma/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib/libinterfaceProperties.so"
#5 Foam::interfaceProperties::interfaceProperties(Foa m::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::IOdictionary const&) in "/home/magma/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib/libinterfaceProperties.so"
#6 Foam::immiscibleIncompressibleTwoPhaseMixture::imm iscibleIncompressibleTwoPhaseMixture(Foam::Geometr icField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) in "/home/magma/OpenFOAM/OpenFOAM-2.3.1/platforms/linux64GccDPOpt/lib/libimmiscibleIncompressibleTwoPhaseMixture.so"
#7
in "/home/magma/OpenFOAM/magma-2.3.1/platforms/linux64GccDPOpt/bin/my_interFoam"
#8 __libc_start_main in "/lib64/libc.so.6"
#9
at /home/abuild/rpmbuild/BUILD/glibc-2.15/csu/../sysdeps/x86_64/elf/start.S:116
Aborted


Thanks,
Hojjat

Andrea_85 June 25, 2015 10:28

I don't have this error. Remember that OF always checks about dimensions.
nHatfv is dimensionless and you are setting nHatfv equal to something which has dimension of m^2. This generates the error.

debug your code and try to understand from where the error comes.

Best,
Andrea

hojjat.m June 27, 2015 14:51

Done,

Thank you very much, ur suggestions really helped. :)


All times are GMT -4. The time now is 08:25.