Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    尝试添加一段代码来求颗粒浓度,wmake出错,大神帮忙看看哪里出问题?

    OpenFOAM
    2
    5
    3583
    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.
    • chpjz0391
      chpjz0391 last edited by CFD中文网

      基于simpleReactingParcelFoam改的主程序:

      #include "fvCFD.H"
      #include "turbulentFluidThermoModel.H"
      #include "basicReactingMultiphaseCloud.H"
      #include "rhoCombustionModel.H"
      #include "radiationModel.H"
      #include "IOporosityModelList.H"
      #include "fvIOoptionList.H"
      #include "SLGThermo.H"
      #include "simpleControl.H"
      #include "basicKinematicCloud.H"
      
      // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
      
      int main(int argc, char *argv[])
      {
          #include "setRootCase.H"
      
          #include "createTime.H"
          #include "createMesh.H"
          #include "readGravitationalAcceleration.H"
      
          simpleControl simple(mesh);
      
          #include "createFields.H"
          #include "createRadiationModel.H"
          #include "createClouds.H"
          #include "createMRF.H"
          #include "createFvOptions.H"
          #include "initContinuityErrs.H"
      
          // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
      /*#############################use parcelType#####################*/
      //typedef typename basicKinematicTypeCloud::particleType parcelType;
      /*#############################end################################*/
      
      
          Info<< "\nStarting time loop\n" << endl;
      
          while (simple.loop())
          {
              Info<< "Time = " << runTime.timeName() << nl << endl;
      
              parcels.evolve();
      
              // --- Pressure-velocity SIMPLE corrector loop
              {
               /*   #include "UEqn.H"
                  #include "YEqn.H"
                  #include "EEqn.H"
                  #include "pEqn.H" */
              }
      
          /*#################calculate the particle concentration, begin.(下面是自己添加的code)################*/
      
      
          forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
          {
              const parcelType& p = iter();
              const label cellI = p.cell();
              pmc[cellI]+=p.nParticles()*p.mass0();
          }
          
          
              pmc /=mesh().V();
           /*#################calculate the particle concentration, end.################*/
      
      
              turbulence->correct();
      
              runTime.write();
      
      
              Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
                  << "  ClockTime = " << runTime.elapsedClockTime() << " s"
                  << nl << endl;
          }
      
          Info<< "End\n" << endl;
      
          return 0;
      }
      
      // ************************************************************************* //
      

      下面是creatFields.H的文件

      Info<< "Creating combustion model\n" << endl;
      
      autoPtr<combustionModels::rhoCombustionModel> combustion
      (
          combustionModels::rhoCombustionModel::New(mesh)
      );
      
      rhoReactionThermo& thermo = combustion->thermo();
      thermo.validate(args.executable(), "h", "e");
      
      SLGThermo slgThermo(mesh, thermo);
      
      basicSpecieMixture& composition = thermo.composition();
      PtrList<volScalarField>& Y = composition.Y();
      
      const word inertSpecie(thermo.lookup("inertSpecie"));
      
      if (!composition.contains(inertSpecie))
      {
          FatalErrorIn(args.executable())
              << "Specified inert specie '" << inertSpecie << "' not found in "
              << "species list. Available species:" << composition.species()
              << exit(FatalError);
      }
      
      volScalarField& p = thermo.p();
      const volScalarField& T = thermo.T();
      const volScalarField& psi = thermo.psi();
      
      volScalarField rho
      (
          IOobject
          (
              "rho",
              runTime.timeName(),
              mesh,
              IOobject::NO_READ,
              IOobject::AUTO_WRITE
          ),
          thermo.rho()
      );
      
      Info<< "\nReading field U\n" << endl;
      volVectorField U
      (
          IOobject
          (
              "U",
              runTime.timeName(),
              mesh,
              IOobject::MUST_READ,
              IOobject::AUTO_WRITE
          ),
          mesh
      );
      //*******************************************//
      	
      	
          Info<< "Reading field pmc\n" << endl;
          volScalarField pmc
          (
              IOobject
              (
                  "pmc",
                  runTime.timeName(),
                  mesh,
                  IOobject::READ_IF_PRESENT,
                  IOobject::AUTO_WRITE
              ),
              mesh
          );
      
      
      
      	/*##########################construct solid concentration field.mass  of the lagrangian particle [kg/(m^3)]##############*/
      
      	
      	
      
      #include "compressibleCreatePhi.H"
      
      mesh.setFluxRequired(p.name());
      
      dimensionedScalar rhoMax
      (
          dimensionedScalar::lookupOrDefault
          (
              "rhoMax",
              simple.dict(),
              dimDensity,
              GREAT
          )
      );
      
      dimensionedScalar rhoMin
      (
          dimensionedScalar::lookupOrDefault
          (
              "rhoMin",
              simple.dict(),
              dimDensity,
              0
          )
      );
      
      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());
      
      Info<< "Creating multi-variate interpolation scheme\n" << endl;
      multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
      
      forAll(Y, i)
      {
          fields.add(Y[i]);
      }
      fields.add(thermo.he());
      
      volScalarField dQ
      (
          IOobject
          (
              "dQ",
              runTime.timeName(),
              mesh,
              IOobject::NO_READ,
              IOobject::AUTO_WRITE
          ),
          mesh,
          dimensionedScalar("dQ", dimEnergy/dimTime, 0.0)
      );
      

      请问程序哪里有问题,大神可以指出来么?

      1 Reply Last reply Reply Quote
      • chpjz0391
        chpjz0391 last edited by CFD中文网

        simpleParticlesFoam.C: In function ‘int main(int, char**)’:
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:18: error: invalid type in declaration before ‘::’ token
                 Container::const_iterator iter = (container).begin();                  \
                          ^
        simpleParticlesFoam.C:89:5: note: in expansion of macro ‘forAllConstIter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
             ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:18: error: expected ‘;’ before ‘::’ token
                 Container::const_iterator iter = (container).begin();                  \
                          ^
        simpleParticlesFoam.C:89:5: note: in expansion of macro ‘forAllConstIter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
             ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:18: error: ‘::const_iterator’ has not been declared
                 Container::const_iterator iter = (container).begin();                  \
                          ^
        simpleParticlesFoam.C:89:5: note: in expansion of macro ‘forAllConstIter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
             ^
        simpleParticlesFoam.C:89:71: error: expected ‘;’ before ‘iter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
                                                                               ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:35: note: in definition of macro ‘forAllConstIter’
                 Container::const_iterator iter = (container).begin();                  \
                                           ^
        simpleParticlesFoam.C:89:71: error: ‘iter’ was not declared in this scope
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
                                                                               ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:35: note: in definition of macro ‘forAllConstIter’
                 Container::const_iterator iter = (container).begin();                  \
                                           ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:52: error: expected primary-expression before ‘)’ token
                 Container::const_iterator iter = (container).begin();                  \
                                                            ^
        simpleParticlesFoam.C:89:5: note: in expansion of macro ‘forAllConstIter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
             ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:61: error: expected ‘)’ before ‘;’ token
                 Container::const_iterator iter = (container).begin();                  \
                                                                     ^
        simpleParticlesFoam.C:89:5: note: in expansion of macro ‘forAllConstIter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
             ^
        simpleParticlesFoam.C:89:30: warning: unused variable ‘basicKinematicTypeCloud’ [-Wunused-variable]
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
                                      ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:465:9: note: in definition of macro ‘forAllConstIter’
                 Container::const_iterator iter = (container).begin();                  \
                 ^
        simpleParticlesFoam.C:89:71: error: ‘iter’ was not declared in this scope
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
                                                                               ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:466:9: note: in definition of macro ‘forAllConstIter’
                 iter != (container).end();                                             \
                 ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:466:27: error: expected primary-expression before ‘)’ token
                 iter != (container).end();                                             \
                                   ^
        simpleParticlesFoam.C:89:5: note: in expansion of macro ‘forAllConstIter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
             ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:468:5: error: expected ‘;’ before ‘)’ token
             )
             ^
        simpleParticlesFoam.C:89:5: note: in expansion of macro ‘forAllConstIter’
             forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
             ^
        simpleParticlesFoam.C:97:20: error: no match for call to ‘(Foam::fvMesh) ()’
                 pmc /=mesh().V();
                            ^
        In file included from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:7:0,
                         from simpleParticlesFoam.C:34:
        /opt/openfoam30/src/finiteVolume/lnInclude/fvMesh.H:79:7: note: candidate is:
         class fvMesh
               ^
        In file included from /opt/openfoam30/src/OpenFOAM/lnInclude/HashTable.H:549:0,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:41,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/token.H:49,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/UListIO.C:28,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/UList.C:225,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/UList.H:474,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/List.H:43,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/labelList.H:48,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/UPstream.H:42,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/Pstream.H:42,
                         from /opt/openfoam30/src/OpenFOAM/lnInclude/parRun.H:35,
                         from /opt/openfoam30/src/finiteVolume/lnInclude/fvCFD.H:4,
                         from simpleParticlesFoam.C:34:
        /opt/openfoam30/src/OpenFOAM/lnInclude/HashTableI.H:145:11: note: T& Foam::HashTable<T, Key, Hash>::operator()(const Key&) [with T = Foam::regIOobject*; Key = Foam::word; Hash = Foam::string::hash]
         inline T& Foam::HashTable<T, Key, Hash>::operator()(const Key& key)
                   ^
        /opt/openfoam30/src/OpenFOAM/lnInclude/HashTableI.H:145:11: note:   candidate expects 1 argument, 0 provided
        In file included from simpleParticlesFoam.C:57:0:
        createFields.H:27:23: warning: unused variable ‘T’ [-Wunused-variable]
         const volScalarField& T = thermo.T();
                               ^
        createFields.H:28:23: warning: unused variable ‘psi’ [-Wunused-variable]
         const volScalarField& psi = thermo.psi();
                               ^
        In file included from simpleParticlesFoam.C:62:0:
        /opt/openfoam30/src/finiteVolume/lnInclude/initContinuityErrs.H:37:8: warning: unused variable ‘cumulativeContErr’ [-Wunused-variable]
         scalar cumulativeContErr = 0;
                ^
        make: *** [Make/linux64GccDPInt32Opt/simpleParticlesFoam.o] Error 1
        
        1 Reply Last reply Reply Quote
        • C
          CFD中文网 last edited by

          Check this:

                    define forAllConstIter(Container,container,iter)                            
            473     for                                                                        
            474     (                                                                          
            475         Container::const_iterator iter = (container).begin();                  
            476         iter != (container).end();                                             
            477         ++iter                                                                 
            478     )
          

          in UList_H.
          并没有看到相关的basicKinematicTypeCloud声明:

              forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter)
              {
              }
          

          kinematicCloud是basicKinematicTypeCloud的具体类么?

          CFD中国标准用户测试帐号
          目前由徐笑笑登录

          chpjz0391 1 Reply Last reply Reply Quote
          • chpjz0391
            chpjz0391 last edited by

            这是之前别人给我的一段code,我根据自己需求改了下放到了我的求解器里。 对C++不太了解。 应该怎么改的?@cfd-china

            1 Reply Last reply Reply Quote
            • chpjz0391
              chpjz0391 @CFD中文网 last edited by

              @cfd-china 这个东西之前是写给DPMFoam的。。然后我搬到我这边了。。就出现这样了。

              1 Reply Last reply Reply Quote
              • First post
                Last post

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