CFD中文网

    CFD中文网

    • 登录
    • 搜索
    • 最新

    output value vs paraFoam?

    OpenFOAM
    1
    1
    190
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • K
      kimy 最后由 编辑

      I am checking that the variables outbut from source code in solver and I found the differences between output and paraFoam. I cannot understand why it happened? The follow is my codes in simpleFoam.C:
      **const dimensionedScalar myZero("myZero", dimensionSet(0,0,0,0,0,0,0),scalar(0) );

      volScalarField k0=myZeroturbulence->k();
      volScalarField nut0=myZero
      turbulence->nut();
      volScalarField nu0=myZero*turbulence->nu();

      const label patchID = mesh.boundaryMesh().findPatchID("wall");
      const tmp<scalarField> tnuw = turbulence->nu(patchID);
      const scalarField& nuw = tnuw();

      const tmp<scalarField> tnutw = turbulence->nut(patchID);
      const scalarField& nutw = tnutw();

      const fvPatchVectorField& Uw = turbulence->U().boundaryField()[patchID];

      const scalarField magGradUw(mag(Uw.snGrad()));

      for (int j=0; j<nut0.size(); j++)
      {
      if (j<=(nutw.size()/2-1)) {nut0[j]=nutw[j]; nu0[j]=nuw[j];}
      if (j>=(mesh.cells().size()-nutw.size()/2)&&j<=mesh.cells().size()-1) {nut0[j]=nutw[j-(mesh.cells().size()-nutw.size())];nu0[j]=nuw[j-(mesh.cells().size()-nutw.size())];}
      }

      volVectorField Uww=U*myZero;
      const fvPatchList& patches = mesh.boundary();
      labelList wallList;
      wallList.clear();

      forAll(patches, patchi)
      {
      const fvPatch& curPatch = patches[patchi];
      if (isType<wallFvPatch>(curPatch))
      {
      forAll(curPatch, facei)
      {
      label faceCelli = curPatch.faceCells()[facei];
      wallList.resize(wallList.size()+1);
      wallList[wallList.size()-1]=faceCelli;
      }
      }
      }

      forAll(wallList,i)
      {

      Uww[wallList[i]] = U[wallList[i]];

      }

      volScalarField uz = Uww.component(vector::Z);
      volVectorField SG = uz*vector(0,0,1);
      volScalarField magGradUww=mag(SG)/myY;

      k0=((nut0+nu0)*magGradUww/0.3);

      Info<<"k0="<<k0<<endl;
      Info<<"nut0="<<nut0<<endl;
      Info<<"nutw="<<nutw<<endl;
      Info<<"magGradUww="<<magGradUww<<endl;
      Info<<"magGradUw="<<magGradUw<<endl;
      Info<<"tauw="<<(nut0+nu0)magGradUww<<endl;
      Info<<"Uw="<<Uw<<endl;
      *

      nutw and magGradUw are copied from nutkwallfunction. In the end, wallshearstress in the paraFoam is not the same as (nut0+nu0)*magGradUww.

      1 条回复 最后回复 回复 引用
      • First post
        Last post