fvMesh 简单分析(待补充)

无摘要

primitiveMesh没有更顶层的类了。常用的方法:

inline label nCells() const; //返回网格个数
const cellList& cells() const; //返回所有的 cell,cell 是由 faces 构成的
const labelList& cellCells(const label celli) const; //返回 celli 的 邻居们
const labelList& edgeCells(const label edgeI) const; //返回共用这条边的所有网格
const labelList& pointCells(const label pointi) const; //返回共用这个点的所有网格
Info<<"mesh.cells()[0]==="<<mesh.cells()[0]<<endl;

返回包围第0个cell的所有面的index:

mesh.cells()[0]===6(0 1 2 4379997 4382913 4391661)

surfaceInterpolation没有更顶层的类了。

lduMesh没有更顶层的类了。

fvMesh 常用的方法:

//- Return cell volumes
const DimensionedField<scalar, volMesh>& V() const;
//- Return old-time cell volumes
const DimensionedField<scalar, volMesh>& V0() const;
//- Return old-old-time cell volumes
const DimensionedField<scalar, volMesh>& V00() const;
//- Return sub-cycle cell volumes
tmp<DimensionedField<scalar, volMesh>> Vsc() const;
//- Return sub-cycl old-time cell volumes
tmp<DimensionedField<scalar, volMesh>> Vsc0() const;
//- Return cell face area vectors
const surfaceVectorField& Sf() const;
//- Return cell face area magnitudes
const surfaceScalarField& magSf() const;
//- Return cell face motion fluxes
const surfaceScalarField& phi() const;
//- Return cell centres as volVectorField
const volVectorField& C() const;
//- Return face centres as surfaceVectorField
const surfaceVectorField& Cf() const;
//- Internal face owner
const labelUList& owner() const
{
return lduAddr().lowerAddr();
}

//- Internal face neighbour
const labelUList& neighbour() const
{
return lduAddr().upperAddr();
}

画了一个2*2*1的网格:

Mesh Information
----------------
nPoints: 18
nCells: 4
nFaces: 20
nInternalFaces: 4

以下三张图为李建治绘制:


下面这段代码来自 CFD中文网

const labelUList& owner = mesh.owner();
//这里的owner只考虑了内部面?
Info<<"owner==="<<owner<<endl;
const labelUList& neighbour = mesh.neighbour();
Info<<"neighbour==="<<neighbour<<endl;

forAll(T,cellI)
{
Info<<"cellI==="<<cellI<<endl;
forAll(mesh.cells()[cellI], faceI)
//遍历当前 cellI 的所有面
{
if (mesh.isInternalFace(mesh.cells()[cellI][faceI]))
//如果这个cellI由6个面包围,则faceI从0到5遍历
{
const label faceIndex = mesh.cells()[cellI][faceI];
//faceIndex 是当前 faceI 真实 index
Info<< " one of faceIndex is " << faceIndex;
Info<< ", and this face's owner is "
<< owner[faceIndex] << ", its neighbour is "
<< neighbour[faceIndex] << nl;
}
}
}
owner===4(0 0 1 2)
这里内部面只有 0 1 2 3,对应的owner是 0 0 1 2
neighbour===4(1 2 3 3)


cellI===0
one of faceIndex is 0, and this face's owner is 0, its neighbour is 1
one of faceIndex is 1, and this face's owner is 0, its neighbour is 2
cellI===1
one of faceIndex is 2, and this face's owner is 1, its neighbour is 3
one of faceIndex is 0, and this face's owner is 0, its neighbour is 1
cellI===2
one of faceIndex is 3, and this face's owner is 2, its neighbour is 3
one of faceIndex is 1, and this face's owner is 0, its neighbour is 2
cellI===3
one of faceIndex is 2, and this face's owner is 1, its neighbour is 3
one of faceIndex is 3, and this face's owner is 2, its neighbour is 3
//- Internal face owner
const labelUList& owner() const
{
return lduAddr().lowerAddr();
}
fvMesh::lduAddr(){return *lduPtr_;}
mutable fvMeshLduAddressing* lduPtr_;
文章作者: Yan Zhang
文章链接: https://openfoam.top/fvMesh/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 OpenFOAM 成长之路
您的肯定会给我更大动力~