网格体积
-
//class: fvMesh Info << "\n-Class: fvMesh--------" << endl; //- Return the object registry - resolve conflict polyMesh/lduMesh. // Type: virtual const objectRegistry & Info << mesh.thisDb() << endl; //- Return reference to name. // Type: const word & Info << mesh.name() << endl; //- Return reference to boundary mesh. // Type: const fvBoundaryMesh & mesh.boundary(); //- Internal face owner. // Type: const labelUList & labelList owners(mesh.owner()); //- Internal face neighbour. // Type: const labelUList & labelList neighbours(mesh.neighbour()); //- Return cell volumes. // Type: const DimensionedField< scalar, volMesh > & Info << mesh.V() << endl; //- Return old-time cell volumes. // Type: const DimensionedField< scalar, volMesh > & Info << mesh.V0() << endl; //- Return old-old-time cell volumes. // Type: const DimensionedField< scalar, volMesh > & Info << mesh.V00() << endl; //- Return sub-cycle cell volumes. // Type: tmp< DimensionedField< scalar, volMesh > > Info << mesh.Vsc() << endl; //- Return sub-cycle old-time cell volumes. // Type: tmp< DimensionedField< scalar, volMesh > > Info << mesh.Vsc0() << endl; //- Return cell face area vectors. // Type: const surfaceVectorField & Info << mesh.Sf() << endl; //- Return cell face area magnitudes. // Type: const surfaceScalarField & Info << mesh.magSf() << endl; //- Return cell face motion fluxes. // Type: const surfaceScalarField & Info << mesh.phi() << endl; //- Return cell centres as volVectorField. // Type: const volVectorField & Info << mesh.C() << endl; //- Return face centres as surfaceVectorField. // Type: const surfaceVectorField & Info << mesh.Cf() << endl; //- Return face deltas as surfaceVectorField. // Type: tmp< surfaceVectorField > Info << mesh.delta() << endl; Info << "----------------------\n" << endl; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //class: fvMesh pointField points(mesh.points()); faceList faces(mesh.faces()); cellList cells(mesh.cells()); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //Class: point = vector Info << "\n-Class: point---------" << endl; point &pt(points[3]); Info << "pt = " << pt << endl; //- Return x component Info << "pt.x() = " << pt.x() << endl; //- Return y component Info << "pt.y() = " << pt.y() << endl; //- Return z component Info << "pt.z() = " << pt.z() << endl; Info << "----------------------\n" << endl; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //class: edge Info << "\n-Class: edges----------" << endl; edge eg(faces[1].faceEdge(1)), eg_(faces[1].faceEdge(3)); label pt_1(eg.start()), &pt_2(eg.end()); Info << "eg = " << eg << endl; //- Return start vertex label Info << "eg.start() = " << pt_1 << endl; //- Return end vertex label Info << "eg.end() = " << pt_2 << endl; //- Given one vertex, return the other Info << "eg.otherVertex(eg.end()) = " << eg.otherVertex(pt_2) << endl; //- Return common vertex // - -1: no common vertex Info << "eg.commonVertex(eg_) = " << eg.commonVertex(eg_) << endl; //- Return reverse edge Info << "eg.reverseEdge() = " << eg.reverseEdge() << endl; //- Return centre (centroid) Info << "eg.centre(points) = " << eg.centre(points) << endl; //- Return the vector (end - start) Info << "eg.vec(points) = " << eg.vec(points) << endl; //- Return scalar magnitude Info << "eg.mag(points) = " << eg.mag(points) << endl; //- Return edge line Info << "eg.line(points) = " << eg.line(points) << endl; //- compare edges // Returns: // - 0: different // - +1: identical // - -1: same edge, but different orientation Info << "Foam::edge::compare(eg, eg.reverseEdge()) = " << Foam::edge::compare(eg, eg.reverseEdge()) << endl; Info << "----------------------\n" << endl; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //class: face Info << "\n-Class: face----------" << endl; face &fe(faces[4]); Info << "fe = " << fe << endl; //- Return true if the face is empty Info << "fe.empty() = " << fe.empty() << endl; //- Return No. of points corresponding to this face Info << "fe.size() = " << fe.size() << endl; //- Return first point Info << "fe.first() = " << fe.first() << endl; //- Return last point Info << "fe.last() = " << fe.last() << endl; //- Return n-th point Info << "fe.operator[](0) = " << fe.operator[](0) << endl; //- Return the points corresponding to this face Info << "fe.points(points) = " << fe.points(points) << endl; //- Centre point of face Info << "fe.centre(points) = " << fe.centre(points) << endl; //- Calculate average value at centroid of face Info << "fe.average(points, points) = " << fe.average(points, points) << endl; //- Magnitude of face area Info << "fe.mag(points) = " << fe.mag(points) << endl; //- Vector normal; magnitude is equal to area of face Info << "fe.normal(points) = " << fe.normal(points) << endl; //- Return face with reverse direction // The starting points of the original and reverse face are identical. Info << "fe.reverseFace() = " << fe.reverseFace() << endl; //- Which vertex on face (face index given a global index) // returns -1 if not found Info << "fe.which(1966) = " << fe.which(1966) << endl; //- Next vertex on face Info << "fe.nextLabel(1) = " << fe.nextLabel(1) << endl; //- Previous vertex on face Info << "fe.prevLabel(1) = " << fe.prevLabel(1) << endl; //- Return number of edges Info << "fe.nEdges() = " << fe.nEdges() << endl; //- Return edges in face point ordering, // i.e. edges()[0] is edge between [0] and [1] Info << "fe.edges() = " << fe.edges() << endl; //- Return n-th face edge Info << "fe.faceEdge(1) = " << fe.faceEdge(1) << endl; //- Return the edge direction on the face // Returns: // - 0: edge not found on the face // - +1: forward (counter-clockwise) on the face // - -1: reverse (clockwise) on the face Info << "fe.edgeDirection(fe.faceEdge(1)) = " << fe.edgeDirection(fe.faceEdge(1)) << endl; //- compare faces // 0: different // +1: identical // -1: same face, but different orientation Info << "Foam::face::compare(fe, fe) = " << Foam::face::compare(fe, fe) << endl; Info << "----------------------\n" << endl; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //class: cell Info << "\n-Class: cell----------" << endl; cell &cl(cells[100]); Info << "cl = " << cl << endl; //- Return true if the cell is empty Info << "cl.empty() = " << cl.empty() << endl; //- Return No. of faces corresponding to this cell Info << "cl.size() = " << cl.size() << endl; //- Return first face Info << "cl.first() = " << cl.first() << endl; //- Return last face Info << "cl.last() = " << cl.last() << endl; //- Return n-th face Info << "cl.operator[](0) = " << cl.operator[](0) << endl; //- Return number of faces Info << "cl.nFaces() = " << cl.nFaces() << endl; //- Return labels of cell vertices Info << "cl.labels(faces) = " << cl.labels(faces) << endl; //- Return the cell vertices Info << "cl.points(faces, points) = " << cl.points(faces, points) << endl; //- Return cell edges Info << "cl.edges(faces) = " << cl.edges(faces) << endl; //- Returns cell centre Info << "cl.centre(points, faces) = " << cl.centre(points, faces) << endl; //- Returns cell volume Info << "cl.mag(points, faces) = " << cl.mag(points, faces) << endl; Info << "----------------------\n" << endl;
-
@李东岳 李老师我测试了下
Info<< "Reading volume\n" << endl; volScalarField volume ( IOobject ( "volume", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh.V() );
提示错误是:
no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject, const Foam::DimensionedField<double, Foam::volMesh>&)’ );
没有这种类型
-
@队长别开枪 请问您测试过吗,我测试了在
createField.H
加入Info << "\n-Class: cell----------" << endl; cell &cl(cells[100]); Info << "cl.centre(points, faces) = " << cl.centre(points, faces) << endl;
报错如下:
createFields.H:33:14: error: ‘cells’ was not declared in this scope cell &cl(cells[100]); ^ createFields.H:34:52: error: ‘points’ was not declared in this scope Info << "cl.centre(points, faces) = " << cl.centre(points, faces) << endl; ^ createFields.H:34:60: error: ‘faces’ was not declared in this scope Info << "cl.centre(points, faces) = " << cl.centre(points, faces) << endl; ^
怎么修改就好了