OpenFOAM-v2206/tutorials/incompressible/pimpleFoam/LES/planeChannel/setups.orig/common/system/controlDict,有一个计算Cf场的函数,可以参考下:
Cf
{
type coded;
libs (utilityFunctionObjects);
name Cf;
timeStart $/timeStart;
writeControl writeTime;
codeExecute
#{
auto* CfPtr =
mesh().getObjectPtr<volScalarField>("Cf");
if (!CfPtr)
{
Info<< "Create skin-friction coefficient field" << nl;
CfPtr = new volScalarField
(
IOobject
(
"Cf",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh(),
dimless
);
regIOobject::store(CfPtr);
}
auto& Cf = *CfPtr;
Info<< "Computing skin-friction coefficient field\n" << endl;
const auto& tau =
mesh().lookupObject<volVectorField>("wallShearStress");
const dimensionedScalar Ubulk(dimVelocity, 17.55);
Cf = mag(tau.component(0))/(0.5*sqr(Ubulk));
#};
}