CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

cell volume error

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By dkxls

Reply
 
LinkBack Thread Tools Display Modes
Old   November 26, 2013, 06:43
Default cell volume error
  #1
New Member
 
Join Date: Feb 2012
Posts: 25
Rep Power: 4
Marshak is on a distinguished road
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. ??
Marshak is offline   Reply With Quote

Old   November 26, 2013, 07:44
Default
  #2
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,066
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
may you want to try:
Quote:
U.mesh.V()[celli]
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   November 26, 2013, 08:05
Default
  #3
New Member
 
Join Date: Feb 2012
Posts: 25
Rep Power: 4
Marshak is on a distinguished road
still the same error
Marshak is offline   Reply With Quote

Old   November 26, 2013, 08:19
Default
  #4
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,066
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
would you please post the whole error line
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   November 29, 2013, 06:29
Default
  #5
New Member
 
Join Date: Feb 2012
Posts: 25
Rep Power: 4
Marshak is on a distinguished road
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,
Marshak is offline   Reply With Quote

Old   November 29, 2013, 06:39
Default
  #6
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 117
Rep Power: 9
dkxls will become famous soon enough
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 How to give enough info to get help).
dkxls is offline   Reply With Quote

Old   November 29, 2013, 10:06
Default
  #7
New Member
 
Join Date: Feb 2012
Posts: 25
Rep Power: 4
Marshak is on a distinguished road
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
Attached Files
File Type: zip mygreyMeanAbsorptionEmission.zip (10.5 KB, 2 views)
Marshak is offline   Reply With Quote

Old   November 29, 2013, 10:28
Default
  #8
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 117
Rep Power: 9
dkxls will become famous soon enough
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: How to give enough info to get help
Especially, always post proper error messages and use 'CODE' tags!
nimasam likes this.
dkxls is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile calcMassFlowC aurore OpenFOAM Programming & Development 12 March 18, 2014 05:22
Errors in UDF shashank312 Fluent UDF and Scheme Programming 6 May 30, 2013 20:30
error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Native Meshers: blockMesh 2 March 14, 2012 10:56
checking the system setup and Qt version vivek070176 OpenFOAM Installation 22 June 1, 2010 12:34
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 21:14


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