/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 0 0 1 0 0 0 ];
internalField uniform 300;
boundaryField
{
INT
{
type fixedValue;
value uniform 300;
}
OUT
{
type zeroGradient;
}
LONGWALL
{
type zeroGradient;
}
WALL
{
type fixedValue;
value #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.parent().parent()
);
const fvMesh& mesh = refCast<const fvMesh>(d.db());
const label id = mesh.boundary().findPatchID("WALL");
const fvPatch& patch = mesh.boundary()[id];
scalarField T(patch.size(), scalar(300) );
scalar gamma = 25e2;
scalar Tin = 300;
scalar Tout = 1400;
scalar L = 2.5e-3;
forAll(T, i)
{
const scalar x = patch.Cf()[i][0];
const scalar y = patch.Cf()[i][1];
const scalar radial = pow(x,2)+pow(y,2);
const scalar dist = sqrt(radial);
if ( dist <= L )
{
scalar alpha = gamma*(dist-L/2);
T[i] = scalar( (Tout-Tin)/2*(exp(2.0*alpha)-1.0)/(exp(2.0*alpha)+1.0)+(Tin+Tout)/2.0 );
}
else if ( dist > L )
{
T[i] = scalar( Tout );
}
}
T.writeEntry("",os);
#};
}
}
}
// ************************************************************************* //
在用codeStream进行设置之后进行decomposePar时出现报错,报错信息如下
--> FOAM FATAL IO ERROR:
"ill defined primitiveEntry starting at keyword 'value' on line 40 and ending at line 108"
file: /home/lucas/桌面/RCH4-0.7/0/T at line 108.
From function primitiveEntry::readEntry(const dictionary&, Istream&)
in file lnInclude/IOerror.C at line 132.
初步接触codeStream的代码,希望各位前辈可以给予指点