CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   #codeStram error: ill defined primitiveEntry starting at keyword 'internalField' (https://www.cfd-online.com/Forums/openfoam/254900-codestram-error-ill-defined-primitiveentry-starting-keyword-internalfield.html)

leoncly March 6, 2024 21:39

#codeStram error: ill defined primitiveEntry starting at keyword 'internalField'
 
hello,

I am extremely new to OpenFOAM, I'm trying to make a simulation of Spinodal decomposition of Benchmark with OpenFoam.I use #codeStream to write the initial conditions under 0 files. This is my codes:


/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class volScalarField;
object c;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 0 0 0 0];

internalField #codeStream
{
codeInclude
#{
#include "fvCFD.H"
#};

codeOptions
#{
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
#};

codeLibs
#{
-lmeshTools \
-lfiniteVolume
#};

code

#{
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
const fvMesh& mesh = refCast<const fvMesh>(d.db());
const scalar c_0=0.5;
const scalar epsilon=0.01;

scalarField c(mesh.nCells(),0.);

forAll(c,i)
{
scalar x = mesh.C()[i][0];
scalar y = mesh.C()[i][1];

c[i] = c_0 + epsilon * (
cos(0.105 * x) * cos(0.11 * y) +
pow(cos(0.13 * x) * cos(0.087 * y), 2) +
cos(0.025 * x - 0.15 * y) * cos(0.07 * x - 0.02 * y));
}
#};
}


boundaryField
{
bottom
{
type zeroGradient;
}
top
{
type zeroGradient;
}
left
{
type zeroGradient;
}
right
{
type zeroGradient;
}
frontAndBack
{
type empty;
}

}

// ************************************************** *********************** //

When i run my case my terminal gives:
FOAM FATAL IO ERROR:
"ill defined primitiveEntry starting at keyword 'internalField' on line 18 and ending at line 88"

file: /home/cxy/OpenFOAM/cxy-9/run/Benchmark/cavity/0/c at line 88.

I checked multiple times but i don't find anything wrong and also my file is 84 lines long.

Please, help me to figure out this.
Many thanks.

leoncly March 7, 2024 21:38

Anybody help? I need you! Thank you 3000 times~


All times are GMT -4. The time now is 08:05.