可以从边界上的face返回这个face属于的cell
const Foam::fvBoundaryMesh &procBoundary = mesh.boundary();
forAll(procBoundary, patch)
{
forAll(procBoundary[patch], facei)
{
const label bcell = boundaryMesh[patch].faceCells()[facei];
}
}
你可以得到所有的边界单元编号,然后做你其它向做的事就应该比较方便了