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

Extract a member function from a class of different solver for "Source Term"

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By clapointe

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 24, 2019, 07:33
Question Extract a member function from a class of different solver for "Source Term"
  #1
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Dear Foamers,

My topic of research is related to coal pyrolysis (solid region) in OpenFOAM. As we know that, when the coal decomposes due to heat, the gases will be released in different fashions. In my first step of work, I simulated coal decomposition process and calculated the heat release rates. In my next step, I need to figure out the path of coal decomposed gases - through streamline plot.
Basically, there are 2 different models - Fluid and Solid. In Fluid model, there is a provision to draw streamline plot for fluid mediums. But in my case of solid pyrolysis model, its not possible to plot streamline graph for coal released gases, because there involve only Solid --> no gas (medium).

Concerning this, I need to develop a separate gas flow (fluid) model for coal released gases based on equations mentioned below:
Quote:
Continuity --> del.(rho*V)= RRg
Ergun --> -delp2 =(F1+F2*(rho*V))(rho*V)
In continuity equation, the right hand side source term - RRg = reaction rate of pyrolysis gases (comes from the solid pyrolysis model).
This source term comes from the member functions of the class "ODESolidChemistryModel".
https://github.com/OpenFOAM/OpenFOAM...emistryModel.H

So while developing fluid model, under createFields, I have to use a pointer to the class ODESolidChemistryModel". Only then, I can extract the member function RRg - as a source term for continuity equation.

But I am not sure how to figure out this pointer.
I'm not even sure with my approach...
Any ideas as how to to extract the member function (RRg) from a class (ODESolidChemistryModel) for the gas flow modelling ?
Kindly someone share ideas please.
Thank you
Kummi is offline   Reply With Quote

Old   December 24, 2019, 18:05
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
Have you looked at coalChemistryFoam? My understanding is that it uses solid (lagrangian) particles to track coal within the gas phase.

Caelan
clapointe is offline   Reply With Quote

Old   December 25, 2019, 01:06
Default
  #3
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Mr. Clapointe,

Thank you for your response.
(1)

Your point is valid "solid (lagrangian) particles to track coal within the gas phase". As per your suggestion, I have looked into coalChemistryFoam, the foam was defined only with the following class below, (not related to solidChemistry model)
Quote:
lagrangian/coalChemistryFoam/createFields.H: autoPtr<combustionModels:siChemistryCombustionModel> combustion
lagrangian/coalChemistryFoam/createFields.H: autoPtr<compressible::turbulenceModel> turbulence
(2)
I look into solvers, in order to search for the class related to "solidChemistryModel for pyrolysis"


In Heat_transfer solver: the class: basicSolidThermo is implemented as,
Quote:
PtrList<basicSolidThermo> thermos(solidRegions.size()); // here no reactions is involved
https://github.com/OpenFOAM/OpenFOAM...eSolidFields.H




The class: basicSolidThermo is obtained from the thermophysicalModels,
Quote:
Foam::basicSolidThermo::NewThermo/basicSolidThermoNew.C
https://github.com/OpenFOAM/OpenFOAM-2.1.x/blob/master/src/thermophysicalModels/basicSolidThermo/basicSolidFoam::autoPtr<Foam::basicSolidThermo>

(3)
Guess, I'm looking for the Class::solidReaction defined in thermophysical model as,

Quote:
Foam::autoPtr<Foam::solidReaction> Foam::solidReaction::New
https://github.com/OpenFOAM/OpenFOAM...olidReaction.C
This Class::solidReaction was not used anywhere in OpenFOAM.
Any ideas how to proceed further ?

Kindly share your ideas

Thank you
Kummi is offline   Reply With Quote

Old   December 25, 2019, 17:30
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
Well I imagine that a (lagrangian) solver that uses some form of reacting cloud would be able to handle reactions -- and by extension a solver named coalChemistryFoam would handle solid to gas phase change for subsequent (gas phase) combustion. And for a lagrangian solver, I would imagine that associated source code would be in src/lagrangian/.../. What you looked at is model instantiation (combustion/turbulence) for gas-phase modeling. But what about looking instead at the (solid particle) lagrangian modeling? Although I could be wrong, I don't think the solidThermo code you referenced will come into play.

Caelan
clapointe is offline   Reply With Quote

Old   December 26, 2019, 00:56
Default
  #5
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Mr. Clapointe,
Thank you for your response. Yes, lagrangian solver that uses some form of reacting cloud to handle reaction. Under src/lagrangian, the pointers are declared. Here in OF 2.1.1, the suffix "New.C" folder name contains the pointer declaration with syntax: Foam::autoPtr XXX.

Quote:
distributionModels/distributionModel/distributionModelNew.C:Foam::autoPtr<Foam::distributionModels::distribut ionModel>
spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C:Foam::autoPtr<Foam::StochasticCollisionModel<Clou dType> >
intermediate/IntegrationScheme/IntegrationScheme/IntegrationSchemeNew.C:Foam::autoPtr<Foam::IntegrationScheme<Type> >
intermediate/submodels/Kinematic/SurfaceFilmModel/SurfaceFilmModel/SurfaceFilmModelNew.C:Foam::autoPtr<Foam::SurfaceFilmModel<CloudType> >
intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObjectNew.C:Foam::autoPtr<Foam::CloudFunctionObject<CloudType > >
intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModelNew.C:Foam::autoPtr<Foam::PhaseChangeModel<CloudType> >
intermediate/submodels/ReactingMultiphase/SurfaceReactionModel/SurfaceReactionModel/SurfaceReactionModelNew.C:Foam::autoPtr<Foam::SurfaceReactionModel<CloudTyp e> >
intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModelNew.C:Foam::autoPtr<Foam:evolatilisationModel<CloudType> >
intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModelNew.C:Foam::autoPtr<Foam::HeatTransferModel<CloudType> >
As stated above, DevolatilisationModel can be used to devolatilize the coal into gas. Other than this, no other pointer related to solid particle was declared in applications/solvers/lagrangian/coalChemistryFoam. So, I felt that the solver lagrangian doesn't help in my case.
Kummi is offline   Reply With Quote

Old   December 26, 2019, 02:10
Default
  #6
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
In addition, I looked into the solid pyrolysis modelling.

(1) The pointers are declared in thermophysicalModels as,
Quote:
thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C:
Foam::autoPtr<Foam::basicSolidThermo> Foam::basicSolidThermo::New ----> (1)

thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelNew.C:
Foam::autoPtr<Foam::solidChemistryModel> Foam::solidChemistryModel::New ----> (2)
(2) The pointer variables are called in regionModels as,

Quote:
regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H:
class reactingOneDim //pyrolysisModel solid thermo properties and fields

// Protected data
//- Reference to the solid chemistry model
autoPtr<solidChemistryModel> solidChemistry_; ----> (2)

//- Reference to solid thermo
basicSolidThermo& solidThermo_; ----> (1)
As per my knowledge, based on declaring pointers above, pyrolysis reaction occurs.
Quote:
Continuity --> del.(rho*V)= RRg
In continuity equation, the right hand side source term - RRg = reaction rate of pyrolysis gases (comes from the solid pyrolysis model).

In my case, the RRg has been calculated already in another solver. So, I want to load the existing result and process them.

Extract a member function from a class by using autoPtr
As stated here in this link,

(i) If the pointer declared is for new reaction calculations (or) (ii) to load existing results - each strategy requires different approaches.
Keep exploring to find a way..
Kummi is offline   Reply With Quote

Old   December 26, 2019, 06:37
Default
  #7
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
If you look at the (gas phase) continuity equation for coalChemistryFoam, there is a particle source term so there is clearly some method for transfer of mass from the solid particle phase to the gas phase. So regardless of how you access it this is happening. I mentioned coalChemistryFoam as a potential method, but it seems that you already are set in the way you calculate it. So perhaps this thread may help : Extracting Reaction Rates OF20x.

Caelan
Kummi likes this.
clapointe is offline   Reply With Quote

Old   December 26, 2019, 22:32
Default
  #8
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 347
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Caelan, Thank you for your patient response then and there.
I guess, I didn't approach my problem in right manner.

As stated above, In continuity equation, the source term RRg [reaction rate of pyrolysis gases from the solid pyrolysis model] was one of the already calculated variables in my 1D pyrolysis model.

So, its not necessary to call any pointer variable, I think. Because, calling any member function (RRg) from a class simulates the respective phenomenon once again.
But in my case, the reaction rate was already calculated, so I just need to extract it --> my first step to do.

Then, I should load the reaction rate in the source term of continuity equation.

Quote:
Continuity --> del.(rho*V)= RRg (load the result in source term)
Looks simple. But technically, I haven't done it before. So, I'm looking ahead to solve this one.

Kindly correct me if I'm wrong anywhere.

**Your comments helps me to think better ^_^
Thank you again
Kummi 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
issue compiling new turbulence model perplexed user OpenFOAM Programming & Development 1 January 13, 2012 03:40
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 04:37
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 06:59
Droplet Evaporation Christian Main CFD Forum 2 February 27, 2007 06:27


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