CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   problem running potentialFoam (http://www.cfd-online.com/Forums/openfoam-solving/116974-problem-running-potentialfoam.html)

sidmajor April 29, 2013 18:13

problem running potentialFoam
 
Hello everybody, it's my first time and i really need help to run potentialfoam with cylinder i've always got this following error:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



--> FOAM FATAL IO ERROR:
"ill defined primitiveEntry starting at keyword 'const' on line 52 and ending at line 137"

file: /home/sid-major/OpenFOAM/root-2.2.0/run/tutorials/basic/potentialFoam/cylinder/system/controlDict at line 137.

From function primitiveEntry::readEntry(const dictionary&, Istream&)
in file lnInclude/IOerror.C at line 132.

FOAM exiting


can someone help me please?

julien.decharentenay April 29, 2013 20:37

As mentioned in the error message, the issue is likely to be in a keyword in the controlDict dictionary at line 137. Can you post the controlDict dictionary?

sidmajor April 30, 2013 10:40

thank you for replying you can check the controldict

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application potentialFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1;

deltaT 0.001;

writeControl timeStep;

writeInterval 1;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

functions
{
// Lookup U
Info<< "Looking up field U\n" << endl;
const volVectorField& U = mesh().lookupObject<volVectorField>("U");

Info<< "Reading inlet velocity uInfX\n" << endl;

scalar ULeft = 0.0;
label leftI = mesh().boundaryMesh().findPatchID("left");
const fvPatchVectorField& fvp = U.boundaryField()[leftI];
if (fvp.size())
{
ULeft = fvp[0].x();
}
reduce(ULeft, maxOp<scalar>());

dimensionedScalar uInfX
(
"uInfx",
dimensionSet(0, 1, -1, 0, 0),
ULeft
);

Info << "U at inlet = " << uInfX.value() << " m/s" << endl;


scalar magCylinder = 0.0;
label cylI = mesh().boundaryMesh().findPatchID("cylinder");
const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI];
if (cylFvp.size())
{
magCylinder = mag(cylFvp[0]);
}
reduce(magCylinder, maxOp<scalar>());

dimensionedScalar radius
(
"radius",
dimensionSet(0, 1, 0, 0, 0),
magCylinder
);

Info << "Cylinder radius = " << radius.value() << " m" << endl;

volVectorField UA
(
IOobject
(
"UA",
mesh().time().timeName(),
U.mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U
);

Info<< "\nEvaluating analytical solution" << endl;

const volVectorField& centres = UA.mesh().C();
volScalarField magCentres(mag(centres));
volScalarField theta(acos((centres & vector(1,0,0))/magCentres));

volVectorField cs2theta
(
cos(2*theta)*vector(1,0,0)
+ sin(2*theta)*vector(0,1,0)
);

UA = uInfX*(dimensionedVector(vector(1,0,0))
- pow((radius/magCentres),2)*cs2theta);

// Force writing of UA (since time has not changed)
UA.write();

volScalarField error("error", mag(U-UA)/mag(UA));

Info<<"Writing relative error in U to " << error.objectPath()
<< endl;

error.write();
#};
}
}

Tushar@cfd May 1, 2013 03:51

Quote:

Originally Posted by sidmajor (Post 424184)
thank you for replying you can check the controldict

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application potentialFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1;

deltaT 0.001;

writeControl timeStep;

writeInterval 1;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

functions
{
// Lookup U
Info<< "Looking up field U\n" << endl;
const volVectorField& U = mesh().lookupObject<volVectorField>("U");

Info<< "Reading inlet velocity uInfX\n" << endl;

scalar ULeft = 0.0;
label leftI = mesh().boundaryMesh().findPatchID("left");
const fvPatchVectorField& fvp = U.boundaryField()[leftI];
if (fvp.size())
{
ULeft = fvp[0].x();
}
reduce(ULeft, maxOp<scalar>());

dimensionedScalar uInfX
(
"uInfx",
dimensionSet(0, 1, -1, 0, 0),
ULeft
);

Info << "U at inlet = " << uInfX.value() << " m/s" << endl;


scalar magCylinder = 0.0;
label cylI = mesh().boundaryMesh().findPatchID("cylinder");
const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI];
if (cylFvp.size())
{
magCylinder = mag(cylFvp[0]);
}
reduce(magCylinder, maxOp<scalar>());

dimensionedScalar radius
(
"radius",
dimensionSet(0, 1, 0, 0, 0),
magCylinder
);

Info << "Cylinder radius = " << radius.value() << " m" << endl;

volVectorField UA
(
IOobject
(
"UA",
mesh().time().timeName(),
U.mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U
);

Info<< "\nEvaluating analytical solution" << endl;

const volVectorField& centres = UA.mesh().C();
volScalarField magCentres(mag(centres));
volScalarField theta(acos((centres & vector(1,0,0))/magCentres));

volVectorField cs2theta
(
cos(2*theta)*vector(1,0,0)
+ sin(2*theta)*vector(0,1,0)
);

UA = uInfX*(dimensionedVector(vector(1,0,0))
- pow((radius/magCentres),2)*cs2theta);

// Force writing of UA (since time has not changed)
UA.write();

volScalarField error("error", mag(U-UA)/mag(UA));

Info<<"Writing relative error in U to " << error.objectPath()
<< endl;

error.write();
#};
}
}


Do the following changes:

Add these color lines at the beginning and bottom of your code as mentioned below:
functions
{
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;

code
#{

// Lookup U
Info<< "Looking up field U\n" << endl;
const volVectorField& U = mesh().lookupObject<volVectorField>("U");
.................
.................
#};
// }
}

:)

sidmajor May 1, 2013 15:36

hello , sorry I tried as you said but it still does not work. I got this error when i tried to check the Mesh:


--> FOAM FATAL ERROR:
Cannot find file "points" in directory "polyMesh" in times 0 down to constant

From function Time::findInstance(const fileName&, const word&, const IOobject::readOption, const word&)
in file db/Time/findInstance.C at line 203.

Tushar@cfd May 2, 2013 02:40

Quote:

Originally Posted by sidmajor (Post 424480)
hello , sorry I tried as you said but it still does not work. I got this error when i tried to check the Mesh:


--> FOAM FATAL ERROR:
Cannot find file "points" in directory "polyMesh" in times 0 down to constant

From function Time::findInstance(const fileName&, const word&, const IOobject::readOption, const word&)
in file db/Time/findInstance.C at line 203.

You need to run blockMesh first...
and after that run the application potentialFoam....

The error you just mentioned above is of blockMesh, once you finish with generating mesh, it will go off.

:)

sidmajor May 2, 2013 14:08

I made ​​no changes on it, after installing the software Openfoam, i wanted to start the solver with his own mesh but it doesn't works i don't know why. Can you check the blockmeshdict if there are some mistake please?


convertToMeters 1;

vertices #codeStream
{
codeInclude
#{
#include "pointField.H"
#};

code
#{
pointField points(19);
points[0] = point(0.5, 0, -0.5);
points[1] = point(1, 0, -0.5);
points[2] = point(2, 0, -0.5);
points[3] = point(2, 0.707107, -0.5);
points[4] = point(0.707107, 0.707107, -0.5);
points[5] = point(0.353553, 0.353553, -0.5);
points[6] = point(2, 2, -0.5);
points[7] = point(0.707107, 2, -0.5);
points[8] = point(0, 2, -0.5);
points[9] = point(0, 1, -0.5);
points[10] = point(0, 0.5, -0.5);
points[11] = point(-0.5, 0, -0.5);
points[12] = point(-1, 0, -0.5);
points[13] = point(-2, 0, -0.5);
points[14] = point(-2, 0.707107, -0.5);
points[15] = point(-0.707107, 0.707107, -0.5);
points[16] = point(-0.353553, 0.353553, -0.5);
points[17] = point(-2, 2, -0.5);
points[18] = point(-0.707107, 2, -0.5);

// Duplicate z points
label sz = points.size();
points.setSize(2*sz);
for (label i = 0; i < sz; i++)
{
const point& pt = points[i];
points[i+sz] = point(pt.x(), pt.y(), -pt.z());
}

os << points;
#};
};


blocks
(
hex (5 4 9 10 24 23 28 29) (10 10 1) simpleGrading (1 1 1)
hex (0 1 4 5 19 20 23 24) (10 10 1) simpleGrading (1 1 1)
hex (1 2 3 4 20 21 22 23) (20 10 1) simpleGrading (1 1 1)
hex (4 3 6 7 23 22 25 26) (20 20 1) simpleGrading (1 1 1)
hex (9 4 7 8 28 23 26 27) (10 20 1) simpleGrading (1 1 1)
hex (15 16 10 9 34 35 29 28) (10 10 1) simpleGrading (1 1 1)
hex (12 11 16 15 31 30 35 34) (10 10 1) simpleGrading (1 1 1)
hex (13 12 15 14 32 31 34 33) (20 10 1) simpleGrading (1 1 1)
hex (14 15 18 17 33 34 37 36) (20 20 1) simpleGrading (1 1 1)
hex (15 9 8 18 34 28 27 37) (10 20 1) simpleGrading (1 1 1)
);

edges
(
arc 0 5 (0.469846 0.17101 -0.5)
arc 5 10 (0.17101 0.469846 -0.5)
arc 1 4 (0.939693 0.34202 -0.5)
arc 4 9 (0.34202 0.939693 -0.5)
arc 19 24 (0.469846 0.17101 0.5)
arc 24 29 (0.17101 0.469846 0.5)
arc 20 23 (0.939693 0.34202 0.5)
arc 23 28 (0.34202 0.939693 0.5)
arc 11 16 (-0.469846 0.17101 -0.5)
arc 16 10 (-0.17101 0.469846 -0.5)
arc 12 15 (-0.939693 0.34202 -0.5)
arc 15 9 (-0.34202 0.939693 -0.5)
arc 30 35 (-0.469846 0.17101 0.5)
arc 35 29 (-0.17101 0.469846 0.5)
arc 31 34 (-0.939693 0.34202 0.5)
arc 34 28 (-0.34202 0.939693 0.5)
);

boundary
(
down
{
type symmetryPlane;
faces
(
(0 1 20 19)
(1 2 21 20)
(12 11 30 31)
(13 12 31 32)
);
}
right
{
type patch;
faces
(
(2 3 22 21)
(3 6 25 22)
);
}
up
{
type symmetryPlane;
faces
(
(7 8 27 26)
(6 7 26 25)
(8 18 37 27)
(18 17 36 37)
);
}
left
{
type patch;
faces
(
(14 13 32 33)
(17 14 33 36)
);
}
cylinder
{
type symmetryPlane;
faces
(
(10 5 24 29)
(5 0 19 24)
(16 10 29 35)
(11 16 35 30)
);
}
);


mergePatchPairs
(
);

Tushar@cfd May 3, 2013 03:46

Quote:

Originally Posted by sidmajor (Post 424751)
I made ​​no changes on it, after installing the software Openfoam, i wanted to start the solver with his own mesh but it doesn't works i don't know why. Can you check the blockmeshdict if there are some mistake please?


convertToMeters 1;

vertices #codeStream
{
codeInclude
#{
#include "pointField.H"
#};

code
#{
pointField points(19);
points[0] = point(0.5, 0, -0.5);
points[1] = point(1, 0, -0.5);
points[2] = point(2, 0, -0.5);
points[3] = point(2, 0.707107, -0.5);
points[4] = point(0.707107, 0.707107, -0.5);
points[5] = point(0.353553, 0.353553, -0.5);
points[6] = point(2, 2, -0.5);
points[7] = point(0.707107, 2, -0.5);
points[8] = point(0, 2, -0.5);
points[9] = point(0, 1, -0.5);
points[10] = point(0, 0.5, -0.5);
points[11] = point(-0.5, 0, -0.5);
points[12] = point(-1, 0, -0.5);
points[13] = point(-2, 0, -0.5);
points[14] = point(-2, 0.707107, -0.5);
points[15] = point(-0.707107, 0.707107, -0.5);
points[16] = point(-0.353553, 0.353553, -0.5);
points[17] = point(-2, 2, -0.5);
points[18] = point(-0.707107, 2, -0.5);

// Duplicate z points
label sz = points.size();
points.setSize(2*sz);
for (label i = 0; i < sz; i++)
{
const point& pt = points[i];
points[i+sz] = point(pt.x(), pt.y(), -pt.z());
}

os << points;
#};
};


blocks
(
hex (5 4 9 10 24 23 28 29) (10 10 1) simpleGrading (1 1 1)
hex (0 1 4 5 19 20 23 24) (10 10 1) simpleGrading (1 1 1)
hex (1 2 3 4 20 21 22 23) (20 10 1) simpleGrading (1 1 1)
hex (4 3 6 7 23 22 25 26) (20 20 1) simpleGrading (1 1 1)
hex (9 4 7 8 28 23 26 27) (10 20 1) simpleGrading (1 1 1)
hex (15 16 10 9 34 35 29 28) (10 10 1) simpleGrading (1 1 1)
hex (12 11 16 15 31 30 35 34) (10 10 1) simpleGrading (1 1 1)
hex (13 12 15 14 32 31 34 33) (20 10 1) simpleGrading (1 1 1)
hex (14 15 18 17 33 34 37 36) (20 20 1) simpleGrading (1 1 1)
hex (15 9 8 18 34 28 27 37) (10 20 1) simpleGrading (1 1 1)
);

edges
(
arc 0 5 (0.469846 0.17101 -0.5)
arc 5 10 (0.17101 0.469846 -0.5)
arc 1 4 (0.939693 0.34202 -0.5)
arc 4 9 (0.34202 0.939693 -0.5)
arc 19 24 (0.469846 0.17101 0.5)
arc 24 29 (0.17101 0.469846 0.5)
arc 20 23 (0.939693 0.34202 0.5)
arc 23 28 (0.34202 0.939693 0.5)
arc 11 16 (-0.469846 0.17101 -0.5)
arc 16 10 (-0.17101 0.469846 -0.5)
arc 12 15 (-0.939693 0.34202 -0.5)
arc 15 9 (-0.34202 0.939693 -0.5)
arc 30 35 (-0.469846 0.17101 0.5)
arc 35 29 (-0.17101 0.469846 0.5)
arc 31 34 (-0.939693 0.34202 0.5)
arc 34 28 (-0.34202 0.939693 0.5)
);

boundary
(
down
{
type symmetryPlane;
faces
(
(0 1 20 19)
(1 2 21 20)
(12 11 30 31)
(13 12 31 32)
);
}
right
{
type patch;
faces
(
(2 3 22 21)
(3 6 25 22)
);
}
up
{
type symmetryPlane;
faces
(
(7 8 27 26)
(6 7 26 25)
(8 18 37 27)
(18 17 36 37)
);
}
left
{
type patch;
faces
(
(14 13 32 33)
(17 14 33 36)
);
}
cylinder
{
type symmetryPlane;
faces
(
(10 5 24 29)
(5 0 19 24)
(16 10 29 35)
(11 16 35 30)
);
}
);


mergePatchPairs
(
);

Hello sidmajor,
Have you checked your OpenFOAM installation properly?
It seems, the main source of error.

Well, you have put "root-2.2.0" name instead of "OpenFOAM-2.2.0"
Recheck the path you have mentioned.

Do check the following steps:
execute the foamSystemCheck script in the bin/ directory to check your system:
cd $HOME/OpenFOAM/OpenFOAM-2.2.0/bin/
./foamSystemCheck

Also execute following command:
. $HOME/.bashrc

For more information refer:

http://www.openfoam.org/download/source.php

:)

sidmajor May 3, 2013 15:48

Ok i'll try it thank you so much for your help.


All times are GMT -4. The time now is 11:39.