# bubbleFoam validation case

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

August 30, 2010, 01:58
#21
Senior Member

Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
Quote:
 Originally Posted by balkrishna Thanks for the link .... Can i get the source code of the solver ?? The implementation of the algorithm is the tough aspect in OpenFOAM .....
Try to contact the Authors of the paper. I believe the code was not released, and it is surely not part of OpenFOAM and OpenFOAM-dev/-ext.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.

 August 30, 2010, 02:11 #22 Senior Member   Balkrishna Patankar Join Date: Mar 2009 Location: Pune Posts: 123 Rep Power: 17 Ok .... Thanks

August 30, 2010, 03:05
#23
Senior Member

Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
Quote:
 Originally Posted by balkrishna Ok .... Thanks
I can give you some hints which are not explained anywhere in the OF documentation (top secret! ), and are quite useful to carry around a lot of fields, as required in multiphase simulations.

Let's assume you have N phases. You will have to define:

- N momentum equations (N velocity fields and N fvVectorMatrices)

- N*(N-1)/2 interaction fields (meaning relative velocities, drag coefficients, ...)

- N-1 phase fraction equations (assuming one fraction is computed as alpha_0 = 1-sum(alpha_i), i != 0. You will need N phase fraction fields for this.

- 1 pressure equation based on the mixture

As you can easily imagine, if N is arbitrary, coding this can be messy, if not done with proper care.

You can collect your phase fields and equations (also objects if you want) for each property in a PtrList (http://foam.sourceforge.net/doc/Doxy..._1PtrList.html).

I will give you an example for the relative velocity fields:

First define:

Code:
`const nUr = N*(N-1)/2;`
You can define
Code:
`PtrList<volScalarField> Ur(nUr);`
Then, each field has to be actually initialized with
Code:
```forAll (Ur, urI)
{
Ur.set
(
urI,
yourFieldInitialization
);
}```
To access the relative velocity of index i, you simply have to use

Code:
`Ur[i]()`
Note the (), because you are actually working with a PtrList now, so you have to invoke the corresponding method that returns the field (or a reference to it)!

The same operation can be done with equations:

Code:
```PtrList<fvVectorMatrix> UEqn(N);

forAll (UEqn, uEqnI)
{
UEqn.set
(
fvm::ddt(U())
+ ...
==
...
);
}```
To solve, you loop again over the PtrList, and for each equation, you have to do

Code:
`solve (UEqn[uEqnI]() == ...);`
More good news! If you consider twoPhaseEulerFoam, instead than bubbleFoam, which is actually a bit more ready to be extended to N phases, you will notice that all the properties of a phase are collected in the phaseModel object.
Of course you can create a ptrList of the phaseModel object, and further simplify your work. If you decide to do this, I would suggest to incorporate alpha in the phaseModel, since it is currently not there, or you have an inconsistent syntax that becomes annoying with many phases.

Last hint: since you are beginning with OpenFOAM from what I read, proceed step by step, and ask questions (poking me by email is allowed too, I do not bite , and I usually answer if I can).

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.

Last edited by alberto; August 30, 2010 at 03:06. Reason: Added link to doxygen

 August 30, 2010, 03:42 #24 Senior Member   Balkrishna Patankar Join Date: Mar 2009 Location: Pune Posts: 123 Rep Power: 17 thats clean .... i was about to write python programs to output the necessary files .... In that way , I can take the user input and just write out the files . However the approach requires the compilation of the source code evrytime you specify different number of components ....

 August 30, 2010, 04:37 #25 Senior Member   Alberto Passalacqua Join Date: Mar 2009 Location: Ames, Iowa, United States Posts: 1,912 Rep Power: 36 No You simply have to read the number of phases from a dictionary (label nPhases, being it integer), before allocating the PtrList objects ;-) Something similar is done in OF for the species in reacting solvers, and in multiphaseInterFoam, but in this last solver the implementation of what they called mixture class abuses a bit of C++ functionality, making the code quite unreadable (never a good idea!). Best, __________________ Alberto Passalacqua GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM - An open-source implementation of quadrature-based moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using.

 Tags bubble, bubblefoam, foam