|
[Sponsors] |
How to calculate liquid volume as the interface moves for interFoam Solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 17, 2008, 17:01 |
Hello All,
How do I calcula
|
#1 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello All,
How do I calculate the volume of the liquid phase as the interface moves for a transient interFoam simulation. Help from the forum members will be appreciated. |
|
April 18, 2008, 05:39 |
hi,
i can give you a code s
|
#2 |
Member
Christian Winkler
Join Date: Mar 2009
Location: Mannheim, Germany
Posts: 63
Rep Power: 17 |
hi,
i can give you a code snipet, that calculates the total mass for fluid 1. just divide this by rho1. Even simplier: integrate over gamma field with the comand found below ;-) regards Christian volScalarField rho1gamma ( IOobject ( "rho1gamma", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), gamma*rho1, gamma.boundaryField().types() ); dimensionedScalar totalMass = fvc::domainIntegrate(rho1gamma); Info << "Mass of Fluid 1 = " << totalMass.value() << " kg" << endl; |
|
April 19, 2008, 00:40 |
Hello Christian,
Thanks a l
|
#3 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello Christian,
Thanks a lot for the code snippet. I have not written/used code earlier in interFoam. I would appreciate if you can give hint on using this appropriately (0, constant, system - directory)? Thanks. |
|
April 19, 2008, 06:12 |
Hello Asaha,
No, that's not
|
#4 |
Senior Member
|
Hello Asaha,
No, that's not part of any case dictionary! The first snippet (IOobject) you'd have to put into the top-level solver file createFields.h. For the second code snippet I recommend a separate header-file (just create one) and include it at the appropriate place in solver.C. Then recompile (wmake). Btw, I think it's a good idea to make a custom solver (see User Guide for details). regards Holger
__________________
Holger Marschall web: http://www.holger-marschall.info mail: holgermarschall@yahoo.de |
|
April 19, 2008, 06:20 |
Hi,
you have to build this
|
#5 |
Member
Christian Winkler
Join Date: Mar 2009
Location: Mannheim, Germany
Posts: 63
Rep Power: 17 |
Hi,
you have to build this into the interFoam solver itself. Simply add it to the source code within the timestep loop at the end of each timestep. Then recomplie interFoam: voila. Look here: ./OpenFOAM/OpenFOAM-1.4.1/applications/solvers/multiphase/interFoam/interFoam.C If you run interFoam from now on, it states the information you want after each timestep. Kind regards Christian |
|
April 19, 2008, 12:11 |
Hello,
Thanks for your advi
|
#6 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello,
Thanks for your advice and help. I will give this a try and get back. Thanks again! |
|
April 19, 2008, 19:03 |
Hello Christian and Holger,
|
#7 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello Christian and Holger,
Thanks for your advice and help. I have followed the steps as below: (1) Added the code snippet in createFields.H file. volScalarField rho1gamma ( IOobject ( "rho1gamma", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), gamma*rho1, gamma.boundaryField().types() ); (2) Then made a rho1gamma.H file having the line dimensionedScalar totalMass = fvc::domainIntegrate(rho1gamma); (3) Added the following lines in interFoam.C file # include rho1gamma.H Info << "Mass of Fluid 1 = " << totalMass.value() << " kg" << endl; (4) recompiled interFoam Please correct me on the above steps. Upon testing the recompiled code, in the output I do see Mass of Fluid 1 = 3.2e-08 kg, but this value does not change with time after successive iterations? Pl. advice me if I need to make changes. Regards, A A Saha. |
|
April 20, 2008, 05:46 |
Hi,
Your setup in the top-l
|
#8 |
Senior Member
|
Hi,
Your setup in the top-level solver seems to be all right! Why your question? Should the overall fluid mass change with time in your case? regards, Holger
__________________
Holger Marschall web: http://www.holger-marschall.info mail: holgermarschall@yahoo.de |
|
April 20, 2008, 05:56 |
Hi,
you could put the whole
|
#9 |
Member
Christian Winkler
Join Date: Mar 2009
Location: Mannheim, Germany
Posts: 63
Rep Power: 17 |
Hi,
you could put the whole code in one header File and include this into your solver, it is simplier but has nothing to do with your question. If your volume fraction should change in your simulation, you have to use an inlet with gamma = 1, right? Check your boundary conditions. Regards Christian |
|
April 20, 2008, 12:39 |
Hello Holger and Christian,
|
#10 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello Holger and Christian,
The mass which is showing up is the initial fluid mass for gamma = 1 set with setFields at the inlet for capillary driven flow in a channel. As the interface moves I expect this value to increase with time for the transient solution. Please correct me if I am making a mistake. Is there a alternative, I have simulation for a number of old cases and wish to calculate liquid volume as the interface moves with time, because the new solver can be used for only new cases. Can paraview or tecplot be used? Kind regards, A A Saha |
|
April 20, 2008, 17:48 |
Hi,
I admit that I have no
|
#11 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
Hi,
I admit that I have not understood the geometric field completely yet, but volScalarField rho1gamma ( IOobject ( "rho1gamma", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), gamma*rho1, gamma.boundaryField().types() ); initializes rho1gamma with gamma*rho1, but it is not updated using this expression each time step, thus you need to add: rho1gamma = gamma*rho1; each time step before the integration - please correct me someone, if I am wrong. Best regards, Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request. |
|
April 21, 2008, 02:53 |
Hi Niels,
yes you are right
|
#12 |
Member
Christian Winkler
Join Date: Mar 2009
Location: Mannheim, Germany
Posts: 63
Rep Power: 17 |
Hi Niels,
yes you are right of course.... (so please ignore the second half of the first sentence in my previous post ;-)) ) This is why i put the whole code in one header file and include it at the and of each timestep. Then the update works... Kind regards Christian |
|
April 21, 2008, 06:32 |
Hi Saha
I wonder if this wi
|
#13 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
Hi Saha
I wonder if this will solve your purpose: dimensionedScalar totalLiquidVolume = sum(mesh.V()*gamma); Info << "Total Liquid Volume, Value: " << totalLiquidVolume.value() << ", Dimensions = " << totalLiquidVolume.dimensions() << endl; just include it into your main solver before runTime.write(); and recompile your solver. It will print the current volume at each iteration. Check it first on a single processor because you might need to change sum() with gSum(). Let me know if it works. Regards Jaswi |
|
April 21, 2008, 08:40 |
Hello Jaswi,
Thank you very
|
#14 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello Jaswi,
Thank you very much for your code snippet. The code is working. The liquid volume is getting upated with time at each iteration. Please advice me as, I also have simulation data for a number of old cases and wish to calculate liquid volume as the interface moves with time, because the new solver can be used for only new cases. Thanks again. Kind regards, A A Saha. |
|
April 21, 2008, 11:11 |
Hi Saha
yes it can be done.
|
#15 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
Hi Saha
yes it can be done. just take a look at the utilities folder. in particular take a look at the postprocessing/velocityfield folder. There you will find a number of post processing utilities. you can adapt any one of those for your own purpose. just take the basic framework and modify it. i suggest magU. study it and then let me know if you have questions. Regards Jaswi |
|
April 26, 2008, 03:56 |
Hello Jaswi,
I have followe
|
#16 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello Jaswi,
I have followed the thread http://www.cfd-online.com/cgi-bin/Op...how.cgi?1/7401 and got the required information to resolve my issue. I have a question regarding the max. and min. gamma values obtained during iterations. Sometimes I get the results something like given below: Liquid phase volume fraction = 0.130194 Min(gamma) = -7.81823e-47 Max(gamma) = 1.0004 The min. value is less than 0 and max. value is more than 1. As I understand gamma should be within 0 and 1 for boundedness. Pl. correct me if I may be missing something critical here. Is something wrong with the simulation results or the values obtained are acceptable for interFoam calculation. Pl. advise me on this. Best regards, A A Saha. |
|
April 26, 2008, 21:00 |
Hi Saha
if one carefully ta
|
#17 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
Hi Saha
if one carefully takes a look at the min and max values for gamma then one can conclude that Min(gamma) = -7.81823e-47 implies gamma approximately equals 0 and regarding the Max(gamma) = 1.0004, as far as my understanding goes it can be because of several reasons: 1) set higher value for write precision in the controlDict to reduce rounding off error. 2)you are usng multigird for the pressure equation 3)this might be an intermediate iteration and when you let the solution converge you will get gamma=1.0 hope that helps and settle the doubt a bit :-) With Best Regards Jaswi |
|
April 27, 2008, 10:39 |
Hello Jaswi,
Thanks for you
|
#18 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello Jaswi,
Thanks for your post. Yes the pressure equation uses multigrid. The log output for the converged solution is after each time step, so the solution may be converged. I will try to set higher value for write precision in the controlDict and see if this helps. Is there a specific documentation which clearly mentions how the interface capturing algorithm is implemented in interFoam. Pl. point me to these, if any. I have read HrvojeJasakPhD.pdf, OnnoUbbinkPhD.pdf, HenrikRuschePhD2002.pdf. I may be missing some other important documentation other than these. With best regards, A A Saha. |
|
April 28, 2008, 05:13 |
Hi Saha
These are the texts
|
#19 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
Hi Saha
These are the texts which I have referred as well. You can also google search with following combination 1) "multiphase flows" AND VOF filetype:pdf 2) "multiphase flows" AND "ishii" filetype:pdf and you will come across some PhD and Master's works . Some of these documents have the basic formulation. Also look into David Hill PhD work. It has the twoPhaseEulerFoam formulation explained. For a very detailed description you can also look into the book Computational Fluid Dynamics with Moving Boundaries by Wei Shyy, H. S. Udaykumar, und Madhukar M. Rao I will keep you posted if I find any more material With Best Regards Jaswi |
|
April 28, 2008, 17:59 |
Hello Jaswi,
Thanks for the
|
#20 |
Member
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17 |
Hello Jaswi,
Thanks for the information on documentation of interFoam. With best regards, A A Saha. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calculating Interface Area with InterFoam | gopala | OpenFOAM Running, Solving & CFD | 28 | December 23, 2021 03:51 |
About interFoam solver | zou_mo | OpenFOAM Running, Solving & CFD | 129 | December 2, 2019 06:39 |
[OpenFOAM] How to plot time vs distance traveled by the interface interFoam | asaha | ParaView | 9 | January 26, 2011 09:05 |
Pressure at liquid liquid interface | Tran | CFX | 0 | June 19, 2008 22:59 |
About interfoam solver | qiu | OpenFOAM Running, Solving & CFD | 0 | May 6, 2007 23:48 |