CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Extract a member function from a class of different solver for "Source Term" (https://www.cfd-online.com/Forums/openfoam/223111-extract-member-function-class-different-solver-source-term.html)

Kummi December 24, 2019 07:33

Extract a member function from a class of different solver for "Source Term"
 
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

clapointe December 24, 2019 18:05

Have you looked at coalChemistryFoam? My understanding is that it uses solid (lagrangian) particles to track coal within the gas phase.

Caelan

Kummi December 25, 2019 01:06

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::psiChemistryCombustionModel> 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

clapointe December 25, 2019 17:30

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

Kummi December 26, 2019 00:56

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 December 26, 2019 02:10

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.

https://www.cfd-online.com/Forums/op...tml#post709898
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..

clapointe December 26, 2019 06:37

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 : https://www.cfd-online.com/Forums/op...tes-of20x.html.

Caelan

Kummi December 26, 2019 22:32

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


All times are GMT -4. The time now is 19:17.