Sylv |
September 16, 2013 08:21 |
Hi Berhnard,
Thanks for your post, it gave me new ideas
As example, I use OF221 and the LES tutorial case "pitzDaily", located in the foam tutorials folder: $FOAM_TUTORIALS/incompressible/pisoFoam/les/pitzDaily
Replace the controlDict by this one:
Code:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pisoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 1e-05;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
gradP
{
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;
redirectType average;
outputControl timeStep;
code
#{
const volScalarField& p = mesh().lookupObject<volScalarField>("p");
const volVectorField gradP = fvc::grad(p);
Info << "gradP[0] =" << gradP[0] << endl;
Info << "gradP[5] =" << gradP[5] << endl;
#};
}
surfaceSampling
{
type surfaces;
functionObjectLibs ("libsampling.so");
enabled true;
outputControl timeStep;
interpolationScheme cellPoint;
surfaceFormat foamFile;
fields (p gradP);
surfaces
(
plane01
{
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
basePoint (0.001 0.001 0);
normalVector (0 1 0);
}
interpolate true;
}
);
}
}
Then, run pisoFoam for a few timestep. The codeStream Is compiled without errors and writes out the values of gradP[0] and gradP[5]. So, now gardP exists during the run. Nevertheless, the sample tool does not create a cutting plane from gradP. So I remplace the controlDict by this one:
Code:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pisoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 0.1;
deltaT 1e-05;
writeControl timeStep;
writeInterval 100;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
gradP
{
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;
redirectType average;
outputControl timeStep;
code
#{
const volScalarField& p = mesh().lookupObject<volScalarField>("p");
volVectorField gradP
(
IOobject
(
"gradP",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::grad(p)
);
Info << "gradP[0] =" << gradP[0] << endl;
Info << "gradP[5] =" << gradP[5] << endl;
#};
}
surfaceSampling
{
type surfaces;
functionObjectLibs ("libsampling.so");
enabled true;
outputControl timeStep;
interpolationScheme cellPoint;
surfaceFormat foamFile;
fields (p gradP);
surfaces
(
plane01
{
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
basePoint (0.001 0.001 0);
normalVector (0 1 0);
}
interpolate true;
}
);
}
}
But this codeStream does not compile properly: the object "runTime" of class "Time" does not not exist. I tried to access the existing "runTime" with a kind of lookup function (like for p), but it does not works.
How could I generate the volVectorField gradP, which can be used by the sample tool?
|