Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    fireFoam createFields.H文件中创建场编译,输出多组分混合物各成分的质量流率,没有效果......

    OpenFOAM
    2
    3
    1392
    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.
    • A
      Alvin last edited by 李东岳

      在fireFoam求解器源程序的createfields.H文件中,根据phi(总质量通量)和Yi(多组分的质量分数),希望创建各组分的通量场,值为phi*Yi,进行如下添加后(标记黄色),编译正常通过,但求解结果文件中并没有发现创建好的通量场,希望各位大神能给与指导,不胜感激。

      autoPtr<combustionModels::psiCombustionModel> combustion
      (
          combustionModels::psiCombustionModel::New
          (
              mesh
          )
      );
      
      Info<< "Reading thermophysical properties\n" << endl;
      
      psiReactionThermo& thermo = combustion->thermo();
      thermo.validate(args.executable(), "h", "e");
      
      SLGThermo slgThermo(mesh, thermo);
      
      basicMultiComponentMixture& composition = thermo.composition();
      PtrList<volScalarField>& Y = composition.Y();
      
      
      const word inertSpecie(thermo.lookup("inertSpecie"));
      
      Info<< "Creating field rho\n" << endl;
      volScalarField rho
      (
          IOobject
          (
              "rho",
              runTime.timeName(),
              mesh,
              IOobject::NO_READ,
              IOobject::AUTO_WRITE
          ),
          thermo.rho()
      );
      
      volScalarField& p = thermo.p();
      const volScalarField& T = thermo.T();
      const volScalarField& psi = thermo.psi();
      
      Info<< "\nReading field U\n" << endl;
      volVectorField U
      (
          IOobject
          (
              "U",
              runTime.timeName(),
              mesh,
              IOobject::MUST_READ,
              IOobject::AUTO_WRITE
          ),
          mesh
      );
      
      #include "compressibleCreatePhi.H"
      
      Info<< "Creating turbulence model\n" << endl;
      autoPtr<compressible::turbulenceModel> turbulence
      (
          compressible::turbulenceModel::New
          (
              rho,
              U,
              phi,
              thermo
          )
      );
      
      // Set the turbulence into the combustion model
      combustion->setTurbulence(turbulence());
      
      volScalarField dQ
      (
          IOobject
          (
              "dQ",
              runTime.timeName(),
              mesh,
              IOobject::NO_READ,
              IOobject::AUTO_WRITE
          ),
          mesh,
          dimensionedScalar("dQ", dimEnergy/dimTime, 0.0)
      );
      
      
      Info<< "Creating field dpdt\n" << endl;
      volScalarField dpdt
      (
          IOobject
          (
              "dpdt",
              runTime.timeName(),
              mesh
          ),
          mesh,
          dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
      );
      
      Info<< "Creating field kinetic energy K\n" << endl;
      volScalarField K("K", 0.5*magSqr(U));
      
      
      #include "readGravitationalAcceleration.H"
      #include "readhRef.H"
      #include "gh.H"
      
      
      volScalarField p_rgh
      (
          IOobject
          (
              "p_rgh",
              runTime.timeName(),
              mesh,
              IOobject::MUST_READ,
              IOobject::AUTO_WRITE
          ),
          mesh
      );
      
      // Force p_rgh to be consistent with p
      p_rgh = p - rho*gh;
      
      mesh.setFluxRequired(p_rgh.name());
      
      multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
      
      forAll(Y, i)
      {
          fields.add(Y[i]);
      }
      fields.add(thermo.he());
      
      %(#fffc99)[PtrList<surfaceScalarField> Ysf;
      forAll(Ysf, i)
      {
          surfaceScalarField Ycf
          (
          IOobject
          (
              IOobject::groupName("Ycf",Y[i].name()),
              runTime.timeName(),
              mesh,
              IOobject::READ_IF_PRESENT,
              IOobject::AUTO_WRITE
          ),
          fvc::interpolate(Y[i])*phi
         );
         Info<< "Ycf is\n" << Ycf << endl;
      }]
      
      IOdictionary additionalControlsDict
      (
          IOobject
          (
              "additionalControls",
              runTime.constant(),
              mesh,
              IOobject::MUST_READ_IF_MODIFIED,
              IOobject::NO_WRITE
          )
      );
      
      Switch solvePrimaryRegion
      (
          additionalControlsDict.lookup("solvePrimaryRegion")
      );
      
      
      A 1 Reply Last reply Reply Quote
      • A
        Alvin @Alvin last edited by 李东岳

        @alvin 抱歉,新添加的代码未能正常黄色标记显示,加入的代码为

        PtrList<surfaceScalarField> Ysf;
        forAll(Ysf, i)
        {
        surfaceScalarField Ycf
        (
        IOobject
        (
        IOobject::groupName(“Ycf”,Y[i].name()),
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::AUTO_WRITE
        ),
        fvc::interpolate(Y[i])*phi
        );
        Info<< “Ycf is\n” << Ycf << endl;
        }
        
        1 Reply Last reply Reply Quote
        • 李东岳
          李东岳 管理员 last edited by

          但求解结果文件中并没有发现创建好的通量场

          你强制写一下看看?field.write();

          线上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