CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   multiphaseInterFoam - creation of the phases in MultiphaseMixture and the iNew class (https://www.cfd-online.com/Forums/openfoam-programming-development/190643-multiphaseinterfoam-creation-phases-multiphasemixture-inew-class.html)

koderer July 19, 2017 05:38

multiphaseInterFoam - creation of the phases in MultiphaseMixture and the iNew class
 
Hi all. I'm trying to understand the details of the multiphaseInterFoam solver.
My aim is to modify the explicit density based solver dbnsFoam of the extend project for use of a mixture of arbitrarily many compressible materials with Mie-Gruneisen type equation of state (no viscosity, no contact angle stuff etc., very simple), and i hope i can use a datastructure similar to the MultiphaseMixture class of multiphaseInterFoam.
In the MultiphaseMixture class I just can't figure out how and when the phases in the phases_ PtrDictionary are created. In the phase.H header i stumble over the definition of the nested class iNew:
Code:

        //- Return a pointer to a new phase created on freestore
        //  from Istream
        class iNew
        {
            const volVectorField& U_;
            const surfaceScalarField& phi_;
        public:
            iNew
            (
                const volVectorField& U,
                const surfaceScalarField& phi
            )
            :
                U_(U),
                phi_(phi)
            {}
            autoPtr<phase> operator()(Istream& is) const
            {
                dictionaryEntry ent(dictionary::null, is);
                return autoPtr<phase>(new phase(ent.keyword(), ent, U_, phi_));
            }
        };

My problem is basically the question: Where does the call of "operator()(Istream& is)" happen?
I gess the creation of the phase objects is done in the constructor of MultiphaseMixture, where the constructor for the phases_ PtrDictionary is called in the line
Code:

    phases_(lookup("phases"), phase::iNew(U, phi)),
I just can't figure out what is going on in this line of code.
What i suppose is: the lookup("phases") command gives back the list of dictionaries for the properties of the component phases, which are read from the transportProperties dictionary. But i only see a call of the iNew contructor which of course gives back an object of type iNew, but i can find nowhere a definition of a constructor of a PtrDictionary which takes an argument of type phase::iNew or something like that. Nor do i find a call of iNew:: operator()(Istream& is), as mentioned. I tried to find out by going through the damBrek4phase tutorial case step by step with a debugger, but didn't manage to get it done right.
Can anybody explain what i'm getting wrong? Since this mechanism with iNew is also used in other solvers, i think it would be worth the time making clear how it works.

Elham September 17, 2017 00:46

Quote:

Originally Posted by koderer (Post 657597)
Hi all. I'm trying to understand the details of the multiphaseInterFoam solver.
My aim is to modify the explicit density based solver dbnsFoam of the extend project for use of a mixture of arbitrarily many compressible materials with Mie-Gruneisen type equation of state (no viscosity, no contact angle stuff etc., very simple), and i hope i can use a datastructure similar to the MultiphaseMixture class of multiphaseInterFoam.
In the MultiphaseMixture class I just can't figure out how and when the phases in the phases_ PtrDictionary are created. In the phase.H header i stumble over the definition of the nested class iNew:
Code:

        //- Return a pointer to a new phase created on freestore
        //  from Istream
        class iNew
        {
            const volVectorField& U_;
            const surfaceScalarField& phi_;
        public:
            iNew
            (
                const volVectorField& U,
                const surfaceScalarField& phi
            )
            :
                U_(U),
                phi_(phi)
            {}
            autoPtr<phase> operator()(Istream& is) const
            {
                dictionaryEntry ent(dictionary::null, is);
                return autoPtr<phase>(new phase(ent.keyword(), ent, U_, phi_));
            }
        };

My problem is basically the question: Where does the call of "operator()(Istream& is)" happen?
I gess the creation of the phase objects is done in the constructor of MultiphaseMixture, where the constructor for the phases_ PtrDictionary is called in the line
Code:

    phases_(lookup("phases"), phase::iNew(U, phi)),
I just can't figure out what is going on in this line of code.
What i suppose is: the lookup("phases") command gives back the list of dictionaries for the properties of the component phases, which are read from the transportProperties dictionary. But i only see a call of the iNew contructor which of course gives back an object of type iNew, but i can find nowhere a definition of a constructor of a PtrDictionary which takes an argument of type phase::iNew or something like that. Nor do i find a call of iNew:: operator()(Istream& is), as mentioned. I tried to find out by going through the damBrek4phase tutorial case step by step with a debugger, but didn't manage to get it done right.
Can anybody explain what i'm getting wrong? Since this mechanism with iNew is also used in other solvers, i think it would be worth the time making clear how it works.


Hi,

I want to manipulate multiphaseInterFoam so I need to have a deep understanding about the criteria of the code. Would you please let me know if you know any paper which the code is written based on it?

Cheers,

Elham

koderer September 21, 2017 07:19

multiphaseInterFoam is interFoam with some additional features, e.g. an arbitrary number n of phases instead of only 2. I think some things in interFoam are explaned in the PhD thesis of Ubbink (i didn't read it thoroughly, i must admit).

behzad-cfd September 22, 2017 06:03

constructor
 
Hi
If you take a look at doxygen (https://cpp.openfoam.org/v5/classFoa...b457a9b01e2c06) the answer is in PtrDictionary constructor which is:
Code:

PtrDictionary ( Istream &  is,
const INew & iNew
)

I hope this could be helpful.

I have a problem in alpha gradient definition (https://www.cfd-online.com/Forums/op...interfoam.html). I'll be appreciated if you can share your info.


All times are GMT -4. The time now is 05:47.