openfoam中获得不同方向上的网格长度

获取不同方向上的网格长度cell size(x,y,z)

const faceList & ff = mesh.faces();
const pointField & pp = mesh.points();

forAll ( mesh.C(), celli)
{
    const cell & cc = mesh.cells()[celli];
    labelList pLabels(cc.labels(ff));
    pointField pLocal(pLabels.size(), vector::zero);

    forAll (pLabels, pointi)
           pLocal[pointi] = pp[pLabels[pointi]];

    scalar xDim = Foam::max(pLocal & vector(1,0,0)) - Foam::min(pLocal & vector(1,0,0));

    // And similar for yDim and zDim
}

你可能感兴趣的:(openfoam,notes)