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. 尝试添加一段代码来求颗粒浓度,wmake出错,大神帮忙看看哪里出问题?

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

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

    基于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 条回复 最后回复
  • chpjz0391C 离线
    chpjz0391C 离线
    chpjz0391
    写于 最后由 CFD中文网 编辑
    #2
    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 条回复 最后回复
  • C 离线
    C 离线
    CFD中文网
    写于 最后由 编辑
    #3

    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中国标准用户测试帐号
    目前由徐笑笑登录

    chpjz0391C 1 条回复 最后回复
  • chpjz0391C 离线
    chpjz0391C 离线
    chpjz0391
    写于 最后由 编辑
    #4

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

    1 条回复 最后回复
  • chpjz0391C 离线
    chpjz0391C 离线
    chpjz0391
    在 中回复了 CFD中文网 最后由 编辑
    #5

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

    1 条回复 最后回复

  • 登录

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