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/)
-   -   cell volume error (https://www.cfd-online.com/Forums/openfoam-programming-development/126793-cell-volume-error.html)

Marshak November 26, 2013 06:43

cell volume error
 
In my code I want to calculate the volume of each cell in the mesh to be used.

here below is the code:


forAll(Y, celli)
{
cell_volume[celli]=mesh.V()[celli];
z_y=cell_volume[celli]*Y[indexCO2][celli]/wCO2;
}


But I get following compilation error:

::mesh’ does not have class type

Can someone let me know what I am missing..do I need to add some header files etc. ??

nimasam November 26, 2013 07:44

may you want to try:
Quote:

U.mesh.V()[celli]

Marshak November 26, 2013 08:05

still the same error

nimasam November 26, 2013 08:19

would you please post the whole error line :)

Marshak November 29, 2013 06:29

error: ‘U’ was not declared in this scope

mesh’ does not have class type

I should mention that I am writing this code for thermal radiation modelling and only need to calculate volume of each cell in the mesh.

regards,

dkxls November 29, 2013 06:39

It would be good if you could give some more information like:
Where do you implement this code? Solver, library, utility ...?
Is this part of a function or just in main?

And please use the 'CODE' tags when you post code or error messages (see http://www.cfd-online.com/Forums/ope...-get-help.html).

Marshak November 29, 2013 10:06

1 Attachment(s)
I have attached the files to compile (put in /thermophysical models/radiation models/submodels/absorptionEmissionModel). I get following errors:

submodels/absorptionEmissionModel/mygreyMeanAbsorptionEmission/mygreyMeanAbsorptionEmission.C: In member function ‘virtual Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::radiation::mygreyMeanAbsorptionEmission::aCo nt(Foam::label) const’:
submodels/absorptionEmissionModel/mygreyMeanAbsorptionEmission/mygreyMeanAbsorptionEmission.C:235:29: error: ‘((const Foam::radiation::mygreyMeanAbsorptionEmission*)thi s)->Foam::radiation::absorptionEmissionModel::mesh’ does not have class type
submodels/absorptionEmissionModel/mygreyMeanAbsorptionEmission/mygreyMeanAbsorptionEmission.C:237:2: error: ‘((const Foam::radiation::mygreyMeanAbsorptionEmission*)thi s)->Foam::radiation::absorptionEmissionModel::mesh’ does not have class type
submodels/absorptionEmissionModel/mygreyMeanAbsorptionEmission/mygreyMeanAbsorptionEmission.C:239:3: error: ‘pathLength’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/mygreyMeanAbsorptionEmission.o] Error 1

dkxls November 29, 2013 10:28

Without looking much further into your code, I see there a quite wild mix of 'mesh', 'mesh()' and 'mesh_' throughout your code.
Here some hints on how to fix it:
The object 'mesh' is only defined in the constructor and can hence only be used there, i.e.
Code:

Foam::radiation::mygreyMeanAbsorptionEmission::mygreyMeanAbsorptionEmission
(
    const dictionary& dict,
    const fvMesh& mesh
)
{
...
}

In all other functions, you have to use:
Code:

this->mesh()
Check your base class (absorptionEmissionModel.H), to see what else you have access to.


Oh and btw, please read this: http://www.cfd-online.com/Forums/ope...-get-help.html
Especially, always post proper error messages and use 'CODE' tags!


All times are GMT -4. The time now is 14:38.