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

multiphaseEulerFoam v8: PhaseSystems - help understanding typedefs

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By perao

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 27, 2021, 00:11
Post multiphaseEulerFoam v8: PhaseSystems - help understanding typedefs
  #1
New Member
 
Join Date: Aug 2013
Posts: 7
Rep Power: 12
perao is on a distinguished road
Hi,

to make it short I am going straight to the point. My apologies for the lack of accuracy with the language and/or technicalities with regards to either the programming language or the OpenFOAM's code terminologies.

For the solver in the subject we find under the multiphaseSystem.C all the aliases for the multiphase system types (the ones we must specify in constant/phaseProperties when setting up a case). For example:

Code:
    typedef
        ThermalPhaseChangePhaseSystem
        <
            PhaseTransferPhaseSystem
            <
                TwoResistanceHeatTransferPhaseSystem
                <
                    MomentumTransferPhaseSystem<phaseSystem>
                >
            >
        >
        thermalPhaseChangeMultiphaseSystem;

    addNamedToRunTimeSelectionTable
    (
        phaseSystem,
        thermalPhaseChangeMultiphaseSystem,
        dictionary,
        thermalPhaseChangeMultiphaseSystem
    );
Questions:

1.The parameter that is past to these PhaseSystems is the phaseSystem class. Is it correct to say that all these typedefs are also a phaseSystem?

2.Most of member functions used by these PhaseSystems come from the phaseSystem class. For example, the pure virtual member function:
Code:
virtual autoPtr<momentumTransferTable> momentumTransfer() = 0
. Now, looking at the innermost class within the above typedef, i.e., the MomentumTransferPhaseSystem, we find this such member function declaration and definition.

In .H:

Code:
virtual autoPtr<phaseSystem::momentumTransferTable> momentumTransfer();
In .C:

Code:
template<class BasePhaseSystem>
Foam::autoPtr<Foam::phaseSystem::momentumTransferTable>
Foam::MomentumTransferPhaseSystem<BasePhaseSystem>::momentumTransfer()
{ <body's function> }
Moving outwards in the typedef, we pass through the TwoResistanceHeatTransferPhaseSystem class, then this is past to PhaseTransferPhaseSystem class. However, in the latter, we find once more the declaration and the definition of
Code:
momentumTransfer()
.

In .H:

Code:
virtual autoPtr<phaseSystem::momentumTransferTable> momentumTransfer();
In .C:

Code:
template<class BasePhaseSystem>
Foam::autoPtr<Foam::phaseSystem::momentumTransferTable>
Foam::PhaseTransferPhaseSystem<BasePhaseSystem>::momentumTransferf()
{
    autoPtr<phaseSystem::momentumTransferTable> eqnsPtr =
        BasePhaseSystem::momentumTransferf();

    phaseSystem::momentumTransferTable& eqns = eqnsPtr();

    this->addDmdtUfs(totalDmdtfs(), eqns);

    return eqnsPtr;
}
a.Since the PhaseTransferPhaseSystem is a class that deals with mass transfer, is it correct to assume that the momentum appears here again in order to be taken into account as a consequence of the mass transfer process?


b.If so, this is why the MomentumTransferPhaseSystem is an inner class in this typedef, so that by using
Code:
BasePhaseSystem::momentumTransferf()
the PhaseTransferPhaseSystem class is actually using the momentum modeling available under the BasePhaseSystem instead of providing a new one?



There are other member functions that could be used in place of the
Code:
momentumTransfer()
, but I guess that the same rationale applies to the others as well.



Extra question: If someone would be able to explain better these templated classes under PhaseSystem which are of type BasePhaseSystem, but at the same time inherits from BasePhaseSystem itself, it would be a great help.

Thank you very much for your time.
perao is offline   Reply With Quote

Old   May 27, 2021, 16:44
Default
  #2
New Member
 
Join Date: Aug 2013
Posts: 7
Rep Power: 12
perao is on a distinguished road
Well, after talking to someone that knows the code much better than I do, the answers for the question 2 are:


a.Yes, the momentumTransfer() is a necessary member function to account for the mass transfer process, which is not modeled in the MomentumTransferPhaseSystem class, hence it does not exist in the inherited code.


b.Basically, the momentumTransfer() declared/defined in PhaseTransferPhaseSystem is just adding new momentum sources on top of the already existent in MomentumTransferPhaseSystem.
perao is offline   Reply With Quote

Old   June 1, 2021, 07:36
Default
  #3
New Member
 
Join Date: Aug 2013
Posts: 7
Rep Power: 12
perao is on a distinguished road
As for the extra question, a quick explanation is given here ( http://www.researchgate.net/publicat...le_user_manual on page 203), which uses KinematicParcel rather than BasePhaseSystem as an example.


First the code snippet:


Code:
template < class ParcelType >
class KinematicParcel
:
    public ParcelType
{
public :
    /* the rest of the code ... */
And now the explanation:


Quote:
The class KinematicParcel is an example for the hardships one faces when trying to understand C++. KinematicParcel is a templated class, with ParcelType as template parameter. In addition KinematicParcel also is derived from its template parameter ParcelType.
Thus, KinematicParcel is a templated class built around ParcelType, however, it is a ParcelType too (by inheritance).
ZZW likes this.
perao is offline   Reply With Quote

Reply

Tags
basephasesystem, multiphaseeulerfoam, phasesystem, typedef


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
volume fraction problem in multiphaseEulerFoam vishalgarg474 OpenFOAM Running, Solving & CFD 2 September 15, 2021 16:19
Understanding hardware & parallel processing requirements yk2359 Hardware 3 May 24, 2018 13:34
multiphaseInterFoam vs multiphaseEulerFoam rahulksoni OpenFOAM 0 August 11, 2017 02:14
Adding Boussinesq Approximation to multiphaseEulerFoam? dschmidt OpenFOAM Programming & Development 1 January 16, 2017 16:40
[waves2Foam] Still not understanding what pressure is being solved for arieljeds OpenFOAM Community Contributions 6 April 22, 2016 04:28


All times are GMT -4. The time now is 11:23.