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

about parcel evolve function

Register Blogs Community New Posts Updated Threads Search

Like Tree18Likes
  • 2 Post By openfoammaofnepo
  • 5 Post By cnsidero
  • 1 Post By openfoammaofnepo
  • 8 Post By cnsidero
  • 2 Post By cnsidero

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 17, 2016, 17:07
Default about parcel evolve function
  #1
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Hi,

In some OpenFOAM lagrangian solver, such as coalChemistryFOAM, the link for this solver is
Code:
https://github.com/OpenFOAM/OpenFOAM-2.3.x/blob/master/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H#L16
There is the following lines:
Code:
        coalParcels.evolve();

        limestoneParcels.evolve();
The objects of coalParcels and limestoneParcels are defined in "createClouds.H":
Code:
Info<< "\nConstructing coal cloud" << endl;
coalCloud coalParcels
(
    "coalCloud1",
    rho,
    U,
    g,
    slgThermo
);

Info<< "\nConstructing limestone cloud" << endl;
basicThermoCloud limestoneParcels
(
    "limestoneCloud1",
    rho,
    U,
    g,
    slgThermo
);
But I did not find the function of evolve() in OpenFOAM, I mean the specific form of this function. Could anybody give me some hints about this? Thanks.
Kummi and YANGLU1021 like this.
openfoammaofnepo is offline   Reply With Quote

Old   January 19, 2016, 15:59
Default
  #2
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
The source file for coalCloud is as follows:

Code:
namespace Foam
{
    typedef ReactingMultiphaseCloud
    <
        ReactingCloud
        <
            ThermoCloud
            <
                KinematicCloud
                <
                    Cloud
                    <
                        coalParcel
                    >
                >
            >
        >
    > coalCloud;
}
Code:
 typedef ReactingMultiphaseCloud <ReactingCloud<ThermoCloud<KinematicCloud<Cloud<coalParcel>>>>> coalCloud;
"coalParcel" is defined in coalParcel.H as follows:
Code:
    typedef ReactingMultiphaseParcel
    <
        ReactingParcel
        <
            ThermoParcel
            <
                KinematicParcel
                <
                    particle
                >
            >
        >
    > coalParcel;

Last edited by openfoammaofnepo; January 28, 2016 at 15:39.
openfoammaofnepo is offline   Reply With Quote

Old   January 20, 2016, 08:24
Default
  #3
Senior Member
 
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22
cnsidero is on a distinguished road
Follow the template trail. It's defined in ReactingCloud:

$FOAM_SRC/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.[C,H]
cnsidero is offline   Reply With Quote

Old   January 25, 2016, 09:17
Default
  #4
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear Chris,

Thank you for your reply. I have checked that but it is still not clear for me to find how 'this->solve(td);' in this "evolve" function, i.e. in the following source codes from the files you mentioned:

Code:
template<class CloudType>
void Foam::ReactingCloud<CloudType>::evolve()
{
    if (this->solution().canEvolve())
    {
        typename parcelType::template
            TrackingData<ReactingCloud<CloudType> > td(*this);

        this->solve(td);
    }
}
Could you please give me some further hints about what is the operation for this->solve(td);? Thank you so much.

-----------------
For pulverized coal combustion case, I guess the changes of individual particles caused by devolatilization and char (solid carbon) combustion are included in this this->solve(td);?

Last edited by openfoammaofnepo; January 25, 2016 at 09:29. Reason: some comments
openfoammaofnepo is offline   Reply With Quote

Old   January 25, 2016, 13:33
Default
  #5
Senior Member
 
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22
cnsidero is on a distinguished road
Go back to coalCloud.H. You'll notice one of the classes the coalCloud typedef is created from is KinematicCloud. KinemeticCloud contains the definition for solve. Line 91 in

$FOAM_SRC/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C

The Lagrangian classes are rather complex due to its policy-based design with templates. It can be a struggle to find where things are and how it all fits together. There's a simple explanation of policy-based design on Wikipedia: https://en.wikipedia.org/wiki/Policy-based_design

ReactingMultiphaseCloud is the host class and the nested classes are the policy classes. As the Wikipedia article mentions, in policy-based design, the host class inherits the methods of the policy classes hence the solve method from KinematicCloud can be called.
alvora, wadekar, serles and 2 others like this.

Last edited by cnsidero; January 25, 2016 at 16:48.
cnsidero is offline   Reply With Quote

Old   January 25, 2016, 15:52
Default
  #6
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear Chris,

Thank you so much for your help. I am reading some source files for the lagrangian solvers in OpenFOAM and found that it is indeed very struggling.

In the Lagrangian solver of OpenFOAM, what is the difference between the terminologies "particle", "parcel" and "cloud"? Since we have "coalParcels.evolve();", so the number of ODEs for the mass, momentum and energy is consistent with the number of parcles?

Thank you again.

OFFO
granzer likes this.
openfoammaofnepo is offline   Reply With Quote

Old   January 26, 2016, 13:06
Default
  #7
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear Chris,

in the KinematicCloud.H [or .C], how is the quantity "UTrans" is caluclated? This is the source term for the momentum equation, but is it related to the models for the different forces?
openfoammaofnepo is offline   Reply With Quote

Old   January 28, 2016, 12:03
Default
  #8
Senior Member
 
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22
cnsidero is on a distinguished road
parcel: represents many particles with identical particle properties
cloud: represents many parcels with varying parcel properties

UTrans: I'm doing all the work here for you so I'll point you in the right direction one more time and then you're own you're own. In KinematicCloud.[C,H] you'll notice the private data member UTrans_ is created or updated from a KinematicCloud<CloudType> object. So the trick is again to recognize the policy-based design of the Lagrangian library. The last policy class coalCloud is defined from is coalParcel, which itself is defined in a similar manner (look in coalParcel.H). The parcel classes are where UTrans is updated (look in $FOAM_SRC/lagrangian/intermediate/parcels/Templates/).

Good luck, Chris

Tip: The shell utilities 'find' and 'grep' are your friend. E.g.

Code:
find $FOAM_SRC/lagrangian "*.[C,H]" | xargs grep -n UTrans\(\) | grep -v lnInclude
will search all .C and .H files in the lagrangian library for the string "UTrans()" and ignore results from the lnInclude directories (duplicates).
cnsidero is offline   Reply With Quote

Old   January 28, 2016, 15:35
Default
  #9
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear Chris,

Your following comment is very helpful for my understanding the code structure, so I mark here:

Code:
The last policy class coalCloud is defined from is coalParcel, which itself is defined in a similar manner (look in coalParcel.H). The parcel classes are where UTrans is updated (look in $FOAM_SRC/lagrangian/intermediate/parcels/Templates/).
I think this is the "channel" between the classes in the following two folders:

Code:
$FOAM_SRC/src/lagrangian/intermediate/clouds
and
Code:
$FOAM_SRC/src/lagrangian/intermediate/parcels
Thanks a lot.
openfoammaofnepo is offline   Reply With Quote

Old   January 28, 2016, 16:06
Default
  #10
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
About the policy-based programming, the following from Wikipedia is help and is paste here for other people's reference:

A key feature of the policy idiom is that, usually (though it is not strictly necessary), the host class will derive from (make itself a child class of) each of its policy classes using (public) multiple inheritance. (Alternatives are for the host class to merely contain a member variable of each policy class type, or else to inherit the policy classes privately; however inheriting the policy classes publicly has the major advantage that a policy class can add new methods, inherited by the instantiated host class and accessible to its users, which the host class itself need not even know about.) A notable feature of this aspect of the policy idiom is that, relative to object-oriented programming, policies invert the relationship between base class and derived class - whereas in OOP interfaces are traditionally represented by (abstract) base classes and implementations of interfaces by derived classes, in policy-based design the derived (host) class represents the interfaces and the base (policy) classes implement them. It should also be noted that in the case of policies, the public inheritance does not represent an is-a relationship between the host and the policy classes. While this would traditionally be considered evidence of a design defect in OOP contexts, this doesn't apply in the context of the policy idiom.

--Wikipedia
openfoammaofnepo is offline   Reply With Quote

Old   January 28, 2016, 16:36
Default
  #11
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
For the cloud related classes in $FOAM_SRC/src/lagrangian/intermediate/clouds, are they only for the policy based coding? Because I found that all the physical and modelling calculations (e.g. the inter-phasic interactions between the continuous and dispersed phases, and also the source terms such as SU, SYi, Srho and Shs) have been performed at the level of parcels, which are in $FOAM_SRC/src/lagrangian/intermediate/parcels.

So that means coalParcels have already all the required terms and interactions, as shown in #2 post above. So in this case, we still use cloud related classes. This seems difficult to understand.
openfoammaofnepo is offline   Reply With Quote

Old   January 28, 2016, 22:42
Default
  #12
Senior Member
 
Chris Sideroff
Join Date: Mar 2009
Location: Ottawa, ON, CAN
Posts: 434
Rep Power: 22
cnsidero is on a distinguished road
"however inheriting the policy classes publicly has the major advantage that a policy class can add new methods, inherited by the instantiated host class and accessible to its users, which the host class itself need not even know about."

I want to emphasize this statement, in particular the bold, because this is what makes the policy design difficult to follow. Since a host class inherits methods from the policy classes, one needs to be aware of the methods within all the policy classes because they're not as obvious as they would be with inherited classes in object oriented design.
cnsidero is offline   Reply With Quote

Old   January 29, 2016, 05:38
Default
  #13
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Quote:
Originally Posted by cnsidero View Post
"however inheriting the policy classes publicly has the major advantage that a policy class can add new methods, inherited by the instantiated host class and accessible to its users, which the host class itself need not even know about."

I want to emphasize this statement, in particular the bold, because this is what makes the policy design difficult to follow. Since a host class inherits methods from the policy classes, one needs to be aware of the methods within all the policy classes because they're not as obvious as they would be with inherited classes in object oriented design.
Thanks, very useful explanations!
openfoammaofnepo is offline   Reply With Quote

Old   October 18, 2016, 18:20
Default
  #14
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear Chris,

For flows laden with particles or droplets, we will always be told about the mass flow rates of the particles and droplets. Based on those, we can easily estimate the number of real particles per second. But typically how many particles should exists in the parcels for a good simulation?

Thank you.

oFFo


Quote:
Originally Posted by cnsidero View Post
parcel: represents many particles with identical particle properties
cloud: represents many parcels with varying parcel properties

UTrans: I'm doing all the work here for you so I'll point you in the right direction one more time and then you're own you're own. In KinematicCloud.[C,H] you'll notice the private data member UTrans_ is created or updated from a KinematicCloud<CloudType> object. So the trick is again to recognize the policy-based design of the Lagrangian library. The last policy class coalCloud is defined from is coalParcel, which itself is defined in a similar manner (look in coalParcel.H). The parcel classes are where UTrans is updated (look in $FOAM_SRC/lagrangian/intermediate/parcels/Templates/).

Good luck, Chris

Tip: The shell utilities 'find' and 'grep' are your friend. E.g.

Code:
find $FOAM_SRC/lagrangian "*.[C,H]" | xargs grep -n UTrans\(\) | grep -v lnInclude
will search all .C and .H files in the lagrangian library for the string "UTrans()" and ignore results from the lnInclude directories (duplicates).
openfoammaofnepo is offline   Reply With Quote

Old   March 8, 2018, 06:13
Default CoalChemistryFoam
  #15
New Member
 
Join Date: Jun 2017
Posts: 12
Rep Power: 8
ms6918 is on a distinguished road
Hello all,
I have started working on coalChemistryFoam. The gas phase equations are given in the solver but i could not find the particle equations(eg-particle mass, particle velocity etc.). Can anyone please help me and tell where can i find the particle equations. I have been stuck for a long time.

Any help is highly appreciated.

Thank You
ms6918 is offline   Reply With Quote

Old   June 26, 2020, 08:54
Default
  #16
New Member
 
Jiaui Zhang
Join Date: Aug 2018
Location: Changsha, China
Posts: 17
Rep Power: 7
charryzzz is on a distinguished road
Quote:
Originally Posted by ms6918 View Post
Hello all,
I have started working on coalChemistryFoam. The gas phase equations are given in the solver but i could not find the particle equations(eg-particle mass, particle velocity etc.). Can anyone please help me and tell where can i find the particle equations. I have been stuck for a long time.

Any help is highly appreciated.

Thank You
Particle equations are solved in the lagrangian class, for example, the particle temperature is updated by calcHeatTransfer in ThermoParcel.C
charryzzz is offline   Reply With Quote

Reply


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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 11:04
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 06:59
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


All times are GMT -4. The time now is 22:42.