Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    切结边界网格命名问题

    OpenFOAM
    2
    4
    1781
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      yang山青 last edited by 李东岳

      我想将我的边界根据边界条件的不同类型划分为不同的类型场,以便以后调用,但是现在的代码报错

          const GeometricField<vector, fvPatchField, volMesh>::Boundary& 
              uBCs = U.boundaryField();
      
          forAll(uBCs, patchi)
          {
              if (uBCs[patchi].type() == "farField") //inlet
              {
                  gSurf_.boundaryField().set
                  (
                      patchi, 
                      fvsPatchField<scalar>::New
                      (
                          "farField", mesh.boundary()[patchi], gSurf_
                      )
                  );
              }
              else if (uBCs[patchi].type() == "bounceBack") //maxwellWall
              {
                  gSurf_.boundaryField().set
                  (
                      patchi, 
                      fvsPatchField<scalar>::New
                      (
                          "bounceBack", mesh.boundary()[patchi], gSurf_
                      )
                  );
              }
          }
      

      错误原因是

      createFields.H: In function ‘int main(int, char**)’:
      createFields.H:160:13: error: passing ‘const Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::Boundary’ as ‘this’ argument discards qualifiers [-fpermissive]
                   );
      

      求解我这问题在哪啊

      1 Reply Last reply Reply Quote
      • 李东岳
        李东岳 管理员 last edited by

        你第一段代码用在哪里了?

        把你createFields.H贴一下?

        线上CFD课程 7月1日报名截止 http://dyfluid.com/class.html
        CFD高性能服务器 http://dyfluid.com/servers.html

        Y 1 Reply Last reply Reply Quote
        • Y
          yang山青 @李东岳 last edited by

          @李东岳 相关的createField.H

              volVectorField U
              (
                  IOobject
                  (
                      "U",
                      runTime.timeName(),
                      mesh,
                      IOobject::MUST_READ,
                      IOobject::AUTO_WRITE
                  ),
                  mesh
              );
          
              surfaceScalarField gSurf_
              (
                  IOobject
                  (
                      "gSurf",
                      mesh.time().timeName(),
                      mesh,
                      IOobject::NO_READ,
                      IOobject::NO_WRITE
                  ),
                  mesh,
                  dimensionedScalar
                  (
                      "0", dimMass/pow3(dimLength), 0.0
                  )
              );
          

          应该就这些了吧

          1 Reply Last reply Reply Quote
          • 李东岳
            李东岳 管理员 last edited by

            你用的什么版本,试试把U.boundaryField()改为U.boundaryFieldRef()

            线上CFD课程 7月1日报名截止 http://dyfluid.com/class.html
            CFD高性能服务器 http://dyfluid.com/servers.html

            1 Reply Last reply Reply Quote
            • First post
              Last post

            CFD中文网 | 东岳流体 | 京ICP备15017992号-2
            论坛登录问题反馈可联系 li.dy@dyfluid.com