Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. 关于库中网格信息读取的相关问题

关于库中网格信息读取的相关问题

已定时 已固定 已锁定 已移动 OpenFOAM
3 帖子 2 发布者 2.7k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • 金 离线
    金 离线
    金哲飞
    写于 最后由 编辑
    #1

    请问想要rigidBodyDynamics库中调用到某patch网格面上的信息。现在想到的方法是在库中找相关的继承函数,再类似mesh.boundaryMesh()。但是这个想法没能实现。请问这种思路是否可行。或者OpenFOAM中是否存在类似直接调用constant/polyMesh中网格信息的操作~希望能给出建议~

    1 条回复 最后回复
  • F 离线
    F 离线
    freevector
    写于 最后由 编辑
    #2

    没问题呀,可以参考applications/test/mesh/Test-mesh.C文件

    /*---------------------------------------------------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     | Website:  https://openfoam.org
        \\  /    A nd           | Copyright (C) 2011-2018 OpenFOAM Foundation
         \\/     M anipulation  |
    -------------------------------------------------------------------------------
    License
        This file is part of OpenFOAM.
    
        OpenFOAM is free software: you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
    
        OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        for more details.
    
        You should have received a copy of the GNU General Public License
        along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
    
    \*---------------------------------------------------------------------------*/
    
    #include "argList.H"
    #include "fvMesh.H"
    #include "volFields.H"
    #include "surfaceFields.H"
    
    using namespace Foam;
    
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    // Main program:
    
    int main(int argc, char *argv[])
    {
    
        #include "setRootCase.H"
        #include "createTime.H"
    
        Info<< "Create mesh, no clear-out\n" << endl;
        fvMesh mesh
        (
            IOobject
            (
                fvMesh::defaultRegion,
                runTime.timeName(),
                runTime,
                IOobject::MUST_READ
            )
        );
    
        Info<< mesh.C() << endl;
        Info<< mesh.V() << endl;
    
        surfaceVectorField Cf = mesh.Cf();
    
        Info<< Cf << endl;
    
        // Test construct from cellShapes
        {
            pointField points(mesh.points());
            cellShapeList shapes(mesh.cellShapes());
    
            const polyBoundaryMesh& pbm = mesh.boundaryMesh();
    
            faceListList boundaryFaces(pbm.size());
            forAll(pbm, patchi)
            {
                boundaryFaces[patchi] = pbm[patchi];
            }
            wordList boundaryPatchNames(pbm.names());
            PtrList<dictionary> boundaryDicts(pbm.size());
            forAll(pbm, patchi)
            {
                OStringStream os;
                os << pbm[patchi];
                IStringStream is(os.str());
                boundaryDicts.set(patchi, new dictionary(is));
            }
    
            word defaultBoundaryPatchName = "defaultFaces";
            word defaultBoundaryPatchType = emptyPolyPatch::typeName;
    
            fvMesh newMesh
            (
                IOobject
                (
                    "newMesh",
                    runTime.timeName(),
                    runTime,
                    Foam::IOobject::NO_READ
                ),
                Xfer<pointField>(points),
                shapes,
                boundaryFaces,
                boundaryPatchNames,
                boundaryDicts,
                defaultBoundaryPatchName,
                defaultBoundaryPatchType
            );
    
            Info<< newMesh.C() << endl;
            Info<< newMesh.V() << endl;
    
            surfaceVectorField Cf = newMesh.Cf();
    
            Info<< Cf << endl;
        }
    
    
        Info<< "End\n" << endl;
    
        return 0;
    }
    
    
    // ************************************************************************* //
    
    金 1 条回复 最后回复
  • 金 离线
    金 离线
    金哲飞
    在 中回复了 freevector 最后由 编辑
    #3

    @freevector 谢谢老师~ 我找到了一个方法,用lookup指针去找model_.time().lookupObject<fvMesh>("region0"),您的方法我有个地方不太理解,就是runTime提示没有申明,不太明白什么意思~

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]