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

problem with speciesTable constructor

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 30, 2010, 09:03
Default problem with speciesTable constructor
  #1
Member
 
Hrushikesh Khadamkar
Join Date: Jul 2010
Location: Mumbai
Posts: 59
Rep Power: 7
Hrushi is on a distinguished road
I am trying to create table of species from the wordList defined in one of the dictionary.

Here is my code:

Info<< nl << "Reading thermophysicalProperties" << endl;

PtrList<volScalarField> Y(3);

IOdictionary speciesProperties
(
IOobject
(
"speciesProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);


wordList speciesName
(
speciesProperties.lookup("speciesNames")
);

speciesTable speciesTable s(wordList speciesName);

dimensionedScalar source_r
(
speciesProperties.lookup("source_r")
);



word inertSpecie(speciesProperties.lookup("inertSpecie" ));

Info << "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info << "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

# include "createPhi.H"


label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);


singlePhaseTransportModel laminarTransport(U, phi);

autoPtr<incompressible::RASModel> turbulence
(
incompressible::RASModel::New(U, phi, laminarTransport)
);


The compilation error with speciesTable constructor is:

createFields.H: In function 'int main(int, char**)':
createFields.H:23: error: 'speciesTable' was not declared in this scope
createFields.H:23: error: expected `;' before 'speciesTable'
/export/apps/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable 'momentumPredictor'
/export/apps/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable 'fluxGradp'
/export/apps/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readSIMPLEControls.H:12: warning: unused variable 'transonic'
make: *** [Make/linux64GccDPOpt/simpleMyFoam.o] Error 1

Any suggestions, please?

Hrushikesh
Hrushi is offline   Reply With Quote

Old   October 30, 2010, 13:30
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
mturcios777 will become famous soon enough
Hi Hrushikesh,

It seems to me that the problem lies in this line:

Code:
speciesTable speciesTable s(wordList speciesName);
I think the line should be

Code:
speciesTable s(speciesName);
My guess is that you want to declare a speciesTable variable names "s", so all you need is the type and a constructor. Also, as you have already declared speciesName as a wordList, so you just need to pass the variable to the constructor.
mturcios777 is offline   Reply With Quote

Old   November 1, 2010, 00:11
Default speciesTable constructor
  #3
Member
 
Hrushikesh Khadamkar
Join Date: Jul 2010
Location: Mumbai
Posts: 59
Rep Power: 7
Hrushi is on a distinguished road
Hi Marco,

I changed the line you have suggested. But the compiler throws up the same error again.

I checked speciesTable.C again. Below is the constructor.

// Construct from list of specie names
Foam::speciesTable::speciesTable(const wordList& specieNames)
:
wordList(specieNames)
{
setIndices();
}

I am now confused what to do? I don't understand the error
createFields.H:23: error: 'speciesTable' was not declared in this scope

Hrushikesh
Hrushi is offline   Reply With Quote

Old   November 1, 2010, 06:07
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 777
Rep Power: 18
olesen will become famous soon enough
Quote:
Originally Posted by Hrushi View Post
Hi Marco,

I changed the line you have suggested. But the compiler throws up the same error again.

I checked speciesTable.C again. Below is the constructor.

// Construct from list of specie names
Foam::speciesTable::speciesTable(const wordList& specieNames)
:
wordList(specieNames)
{
setIndices();
}

I am now confused what to do? I don't understand the error
createFields.H:23: error: 'speciesTable' was not declared in this scope

Hrushikesh

Perhaps it is just something quite banal - like a missing include?

In the Make/options:
Code:
   -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
In your code:
Code:
    #include "speciesTable.H"
/mark
olesen is offline   Reply With Quote

Old   November 1, 2010, 07:34
Default
  #5
Member
 
Hrushikesh Khadamkar
Join Date: Jul 2010
Location: Mumbai
Posts: 59
Rep Power: 7
Hrushi is on a distinguished road
Quote:
Originally Posted by olesen View Post
Perhaps it is just something quite banal - like a missing include?

In the Make/options:
Code:
   -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
In your code:
Code:
    #include "speciesTable.H"
/mark
Hi,

I have included the above suggestions. The error message is the same.
Here is the error message:

In file included from simpleMyFoam.C:44:
createFields.H:1:26: error: speciesTable.H: No such file or directory
In file included from simpleMyFoam.C:44:
createFields.H: In function 'int main(int, char**)':
createFields.H:25: error: 'speciesTable' was not declared in this scope
createFields.H:25: error: expected `;' before 'species'
/export/apps/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable 'momentumPredictor'
/export/apps/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable 'fluxGradp'
/export/apps/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readSIMPLEControls.H:12: warning: unused variable 'transonic'
make: *** [Make/linux64GccDPOpt/simpleMyFoam.o] Error 1

Line no 44 in simpleMyFoam is createFields.H line


Hrushikesh
Hrushi is offline   Reply With Quote

Old   November 1, 2010, 08:25
Default
  #6
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
Hi Hrushikesh,
I think you have to insert the #include inside the header of your code, i.e. before
Code:
int main(int argc, char *argv[])
instead of inseting it inside createFields.H.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   November 2, 2010, 08:31
Default speciesTable constructor
  #7
Member
 
Hrushikesh Khadamkar
Join Date: Jul 2010
Location: Mumbai
Posts: 59
Rep Power: 7
Hrushi is on a distinguished road
Hi Stefan/Mark/Marco,

Thanks for your help. The problem is solved now.

Thanks

Hrushi
Hrushi 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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Incoherent problem table in hollow-fiber spinning Gianni FLUENT 0 April 5, 2008 10:33
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
convergence problem Trushar Phoenics 5 August 27, 2002 23:40


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