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/)
-   -   Using incident radiation (G) in the solver (https://www.cfd-online.com/Forums/openfoam-programming-development/89007-using-incident-radiation-g-solver.html)

Mostafa June 1, 2011 08:56

Using incident radiation (G) in the solver
 
1 Attachment(s)
Dear all,


I have some problems while generating a new solver base on the icoFOAM in OpenFOAM 1.7.0.
At first, I have added the radiation model and two species transport equations (YH2O2 and YOHr) to the icoFOAM. Up to this step the solver worked correctly and provided reasonable results. Then I wanted to use incident radiation (G or G_) as a part of the source term of the species transport equations. But I got this error:


Quote:

In file included from WUVrad.C:118:
chemicalComponents.H: In function ‘int main(int, char**)’:
chemicalComponents.H:7: error: ‘G’ was not declared in this scope
It seems that the G (incident radiation) is a private scalerfield in the radiation models.
I wonder if there is anyway to use the incident radiation (G) as a parameter in my solver?


The files of the solver are attached.


Any help would be appreciated.


Regards
Mostafa

wangchengan2003 May 1, 2018 04:51

Dear Mostaf,
I meet samiliar problem like you. I want to use incident radiaton in my solver. But it is private scalarfield. Have you solved your problem?
Chengan

wangchengan2003 May 2, 2018 08:10

1 Attachment(s)
Hello everyone,

I want to use incident radiation 'G' in my solver, which is in the attachement.

In c++ code, it writes

Code:

class fvDOM
:
    public radiationModel
{
    // Private data


        //- Incident radiation  [W/m2]
        volScalarField G_;

Code:

            //- Const access to incident radiation field
            inline const volScalarField& G() const;

It seems that incident radition 'G' is private scalar field. If somebody could give me some suggestiong?

Best regards

Chengan

mAlletto May 21, 2019 04:44

Maybe the reply is a bit late but one can access a field present in memory by the following command:

const volScalarField& G_ = U.mesh().lookupObject<volScalarField>("G");

it gives you constant access to the desired field (obviously it cannot be modified)

Best

Michael

wangchengan2003 May 26, 2019 20:51

Hello Michael,


Thank you for your reply.


Best regards


Chengan


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