OpenFOAM网格和场资料收集整理
Foam::PrimitiveMesh
构造函数
PrimitiveMesh
(
const label nPoints,
const label nInternalFaces,
const label nFaces,
const label nCells
);
virtual const pointFiels &points() const=0;
virtual const faceList &faces() const=0;
virtual const labelList &faceOwner()const=0;
virtual const labelList &faceNeighbour() const=0;
Foam::PrimitivePatch
构造函数
PrimitivePatch
(
const FaceList &faces,
const Field<PointType> &points
);
Foam::polyMesh
Foam::PrimitiveMesh的唯一派生类型。可从文件读取网格
explicit polyMesh(const IOobject &io);
并实现了Foam::PrimitiveMesh的虚函数。含有边界网格私有数据成员
mutable polyBoundaryMesh boundary_;
Foam::polyBoundaryMesh派生自Foam::polyPatchList, 既Foam::polyPatch列表。 该列表中的每一个元素都是polyPatch类型。
Foam::fvMesh
Foam::fvMesh派生自Foam::polyMesh
可从IOobject构造
一个经典的例子是位于/src/OpenFOAM/include的createMesh.H文件。该文件包含了创建fvMesh网格的代码,是所有求解器必须使用的
Foam::Info
<< "Create mesh for time = "
<< runTime.timeName() << Foam::nl << Foam::endl;
Foam::fvMesh mesh
(
Foam::IOobject
(
Foam::fvMesh::defaultRegion,
runTime.timeName(),
runTime,
Foam::IOobject::MUST_READ
)
);
Foam::polyPatch
派生自Foam::PrimitivePatch
构造函数
polyPatch
(
const word &name,
const label size,
const label start,
const label index,
const polyBoundaryMesh &bm,
const word &patchType
);
polyPatch
(
const word &name,
const dictionary &dict,
const label index,
const polyBoundaryMesh &bm,
const word &patchType
);
Foam::fvPatch
不是派生自Foam::polyPatch
fvPatch(const polyPatch&, const fvBoundaryMesh&);
Foam::fvBoundaryMesh
Foam::Field
派生自List,一个数组,没有网格和量纲,支持基本数组计算(比如max,sum,sqr,pow,+,-)
一些别名
typedef Field<label> labelField;
typedef Field<scalar> scalarField;
typedef Field<vector> vectorField;
typedef Field<tensor> tensorField;
Foam::DimensionField派生自Foam::Field,添加了网格和量纲,但没有边界条件.
Foam::GeometricField派生自Foam::DimensionField,内置boundary类,考虑了边界条件
别名
typedef GeometricField<scalar, fvPatchField, volMesh> volScalarField;
typedef GeometricField<vector, fvPatchField, volMesh> volVectorField;
typedef GeometricField<sphericalTensor, fvPatchField, volMesh> volSphericalTensorField;
typedef GeometricField<symmTensor, fvPatchField, volMesh> volSymmTensorField;
typedef GeometricField<tensor, fvPatchField, volMesh> volTensorField;
typedef GeometricField<scalar, pointPatchField, pointMesh> pointScalarField;
typedef GeometricField<vector, pointPatchField, pointMesh> pointVectorField;
typedef GeometricField<sphericalTensor, pointPatchField, pointMesh> pointSphericalTensorField;
typedef GeometricField<symmTensor, pointPatchField, pointMesh> pointSymmTensorField;
typedef GeometricField<tensor, pointPatchField, pointMesh> pointTensorField;
其中类Foam::fvPatchField和Foam::fvsPatchField用于考虑边界条件
一个经典的案例是读取初始温度场
Info << "Reading field T\n"
<< endl;
volScalarField T //温度场
(
IOobject(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE),
mesh
);