下面这个代码是对壁面一层网格进行赋值的。你可以参考一下。mag可以。
//- Initialise the near-wall P field to zero
forAll(patches, patchi)
{
const fvPatch& currPatch = patches[patchi];
if (isA<wallFvPatch>(currPatch))
{
forAll(currPatch, facei)
{
label faceCelli = currPatch.faceCells()[facei];
epsilon[faceCelli] = 0.0;
G[faceCelli] = 0.0;
}
}