problem with speciesTable constructor
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 |
Hi Hrushikesh,
It seems to me that the problem lies in this line: Code:
speciesTable speciesTable s(wordList speciesName); Code:
speciesTable s(speciesName); |
speciesTable constructor
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 |
Quote:
Perhaps it is just something quite banal - like a missing include? In the Make/options: Code:
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude Code:
#include "speciesTable.H" |
Quote:
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 |
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[]) Regards, Stefan |
speciesTable constructor
Hi Stefan/Mark/Marco,
Thanks for your help. The problem is solved now. Thanks:):D Hrushi |
All times are GMT -4. The time now is 06:53. |