这是我根据网上的模板修改的一个喷口边界条件(jet),喷口的速度随时间和空间位置变化,可以正常使用。请问一下,如果我想输出网格ID为faceI0的格心的压力,应该怎么实现呢? 再进一步,如果这个网格点不在jet边界上(比如在hump边界上),那么在这里可以获得该点的压力吗?
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "11012";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
backfront
{
type empty;
}
hump
{
type noSlip;
}
inlet
{
type timeVaryingMappedFixedValue;
offset constant (0 0 0);
value nonuniform List<vector>
216
(..... ) ;
}
jet
{
type codedFixedValue;
name nouse;
value (0 0 0);
redirectType jeton;
codeOptions
#{
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
#};
codeInclude
#{
#include "fvCFD.H"
#include <cmath>
#include <iostream>
#};
code
#{
const fvPatch& boundaryPatch = patch();
const vectorField& Cf = boundaryPatch.Cf();
vectorField& field = *this;
const scalar pi = constant::mathematical::pi;
scalar x0=0.654157, z0=0.115013, d=0.004554;
scalar umax=26.6, fjet=138.5;
scalar theta = 18.31163/pi;
forAll(Cf, faceI)
{
scalar x = Cf[faceI].x();
scalar z = Cf[faceI].z();
scalar t = this->db().time().value();
scalar kesi = pow( (x-x0)*(x-x0)+(z-z0)*(z-z0),0.5);
scalar ujmag = 6*umax*( (kesi/d)-pow(kesi/d,2) )*sin(2*pi*fjet*t);
scalar ujet = ujmag*sin(theta);
scalar vjet = ujmag*cos(theta);
field[faceI] = vector(ujet,0,vjet);
}
#};
}
lowWall
{
type noSlip;
}
outlet
{
type zeroGradient;
}
top
{
type zeroGradient;
}
}