CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

multiphaseInterFoam - creation of the phases in MultiphaseMixture and the iNew class

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2017, 05:38
Default multiphaseInterFoam - creation of the phases in MultiphaseMixture and the iNew class
  #1
New Member
 
Join Date: Jan 2012
Posts: 9
Rep Power: 14
koderer is on a distinguished road
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.

Last edited by koderer; July 20, 2017 at 04:10.
koderer is offline   Reply With Quote

Old   September 17, 2017, 00:46
Default
  #2
Senior Member
 
Elham
Join Date: Oct 2009
Posts: 184
Rep Power: 16
Elham is on a distinguished road
Quote:
Originally Posted by koderer View Post
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
Elham is offline   Reply With Quote

Old   September 21, 2017, 07:19
Default
  #3
New Member
 
Join Date: Jan 2012
Posts: 9
Rep Power: 14
koderer is on a distinguished road
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).
koderer is offline   Reply With Quote

Old   September 22, 2017, 06:03
Default constructor
  #4
Member
 
behzad Ghasemi
Join Date: Sep 2013
Location: Iran
Posts: 56
Rep Power: 12
behzad-cfd is on a distinguished road
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 (Alpha gradient definition in multiphaseInterFoam ?!). I'll be appreciated if you can share your info.
behzad-cfd is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:07.