Quote:
Do you know how I can determine changing bubble diameter during run and relative velocity?? Best |
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 |
1 Attachment(s)
Quote:
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... |
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?
|
Quote:
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?? |
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 |
Quote:
- 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? |
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. |
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 :) |
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 |
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 |
But I think the main problem is the following error:
‘interface’ was not declared in this scope |
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 |
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 |
try with
mixture.nHatfv(); |
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 :( |
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 |
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 |
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 |
Done,
Thank you very much, ur suggestions really helped. :) |
All times are GMT -4. The time now is 08:25. |