CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   fvMatrix to volScalarField coversion ? (https://www.cfd-online.com/Forums/openfoam-programming-development/153047-fvmatrix-volscalarfield-coversion.html)

lfgmarc May 15, 2015 19:14

fvMatrix to volScalarField coversion ?
 
Hi everybody,

I'm try to use the combustion model class of openfoam, it has a member function that returns the source therm for species equations (Reaction rate):

virtual tmp<fvScalarMatrix> R(volScalarField& Y) const = 0;


If I understand well, this funcion is overloaded with the calculation way provided by reaction model for R that is selected at runtime. it function returns a fvScalarMatrix. My question is if I want to define a new volScalarfield, for example, Rates, It is possible to utilices this fvScalarMatrix and define a volScalarField , exists any form to make this conversion ?

Any advice will be graatly appreciated, thanks in advance


Felipe

xuhuang September 8, 2016 09:04

Hi Felipe,

I have the same problem. Have you succeed?

cheers,
Xu

anishtain4 September 8, 2016 14:03

Hi,

As you know the method is abstract and needs to be overloaded. But what you are trying to achieve is not clear to me. If you want a volScalarFeild, then you can just look for where R has been called and use the input argument of it. You already have that volScalarField (y), why convert it from R?

japaf March 21, 2019 06:32

You have to multiply by the respective field to get volScalarField from fvMatrix (check how it is used in Qdot function in singleStepCombustion.C). Basically, you need to do
Code:

Rates = R(Y) & Y;


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