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. ?? |
may you want to try:
Quote:
|
still the same error
|
would you please post the whole error line :)
|
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, |
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). |
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 |
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 Code:
this->mesh() 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. |