@BlookCFD 解决了,受到下面代码的启发,即重复利用代码,更新边界名称即可
p
{
solver GAMG;
tolerance 1e-6;
relTol 0;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 100;
mergeLevels 1;
}
pFinal
{
$p;
relTol 0;
}
最后的要实现结果如下图:
forceCoeffs_object
{
// rhoInf - reference density
// CofR - Centre of rotation
// dragDir - Direction of drag coefficient
// liftDir - Direction of lift coefficient
// pitchAxis - Pitching moment axis
// magUinf - free stream velocity magnitude
// lRef - reference length
// Aref - reference area
type forceCoeffs;
functionObjectLibs ("libforces.so");
//patches ("body1" "body2" "body3");
patches (C0);
pName p;
Uname U;
rho rhoInf;
rhoInf 1.0;
//// Dump to file
log true;
CofR (0.0 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 1.0;
lRef 1.0; // reference lenght for moments!!!
Aref 2.0; // reference area 1 for 2d
writeControl timeStep;
writeInterval 1;
}
//监测新的边界条件,只需要重复利用代码,更新边界名称即可
C1
{
$forceCoeffs_object
patches (C1);
}