湍流模型里面如何输出动态系数



  • 目前想输出湍流模型中的系数,以Dynamic Smagorinsky-Lilly模型为例,在该模型中,如果想输出模型中的动态系数Cs^2怎么办呢?

    Dynamic Smagorinsky-Lilly.C文件中输出的动态系数CD(Cs^2)代码如下

    volScalarField dynamicSmagorinsky::cD
    (
        const volSymmTensorField& D
    ) const
    {
        tmp<volSymmTensorField> LL = 
    	dev(filter_(sqr(U())) - (sqr(filter_(U()))));//sqr returns the outer product of U, the deviatoric part is explicitly expressed, while the isotropic part is in the pressure term
    
        const volSymmTensorField MM
        (
            sqr(delta())*(filter_(mag(D)*(D)) - 4*mag(filter_(D))*filter_(D))
        );
    
        // Locally averaging MMMM on cell faces
        volScalarField MMMM = fvc::average(magSqr(MM));
    
        MMMM.max(VSMALL);
    
        // Performing local average on cell faces on return
        return 0.5*fvc::average(LL && MM)/MMMM;
    }
    

    网上有人说 在湍流模型中定义一个系数(即CD,表达式同上),并利用swak4Foam输出,具体应该怎么操作呢?

    请好心朋友指点一下



  • 目前进行了一些尝试,但编译过程中存在一定的问题,请大家指点一下

    下面是试验的湍流模型的.C部分程序,模型的系数为CSW,想输出每个时刻CSW的场,在代码后面加了IOobject的代码

    // * * * * * * * * * * * * * Private Member Functions  * * * *  * * * * //
    
    void DCMM::updateSubGridScaleFields
    (
        const volTensorField& gradU
    )
    {
      
        nuSgs_ = sqr(delta())*(C(gradU).component(vector::X)*sqrt(2.0)*mag(S(gradU))*S(gradU)
        nuSgs_.correctBoundaryConditions();
    }
    
    dimensionedVector  DCMM::C
    (
        const volTensorField& gradU
    ) const
    {
    
    // Sij,Mij,Omegaij,Pij and Lij 
    const volSymmTensorField S = symm(gradU);    
    
    const volSymmTensorField M = 4*sqr(delta())*sqrt(2.0)*mag(filter_(S))*filter_(S)-sqr(delta())*filter_(sqrt(2.0)*mag(S)*S);
    
    const volTensorField O = -skew(gradU);    
    
    const volTensorField N = 4*sqr(delta())*((filter_(S)&filter_(O))-(filter_(O)&filter_(S))-dev(filter_(S)&filter_(S)));
    
    const volTensorField P = 4*sqr(delta())*((filter_(O)&(filter_(S)&filter_(S)))
    
    const volSymmTensorField L = dev(filter_(sqr(U())) - (sqr(filter_(U()))));
    
    const volScalarField MM = M&&M;
    
    const volScalarField MN = M&&N;
    
    const volScalarField MP = M&&P;
    
    const volScalarField NM = N&&M;
    
    const volScalarField NN = N&&N;
    
    const volScalarField NP = N&&P;
    
    const volScalarField PM = P&&M;
    
    const volScalarField PN = P&&N;
    
    const volScalarField PP = P&&P;
    
    const volScalarField ML = M&&L;
    
    const volScalarField NL = N&&L;
    
    const volScalarField PL = P&&L;
    
    const volScalarField CS1 = (ML*NN*PP - ML*NP*PN - MN*NL*PP + MN*NP*PL + MP*NL*PN - MP*NN*PL);
    
    const volScalarField CS2 = (MM*NN*PP - MM*NP*PN - MN*NM*PP + MN*NP*PM + MP*NM*PN - MP*NN*PM);
    
    const dimensionedScalar CSW = CS1.weightedAverage(mesh_.V())/max(CS2.weightedAverage(mesh_.V()),small2_);
    
     return vector(1,0,0)*CSW
    
     CSW
        (
            IOobject
            (
                "CSW",
                runTime_.timeName(),
                mesh_,
                IOobject::MUST_READ,
                IOobject::AUTO_WRITE
            ),
            mesh_
        );
    }
    

    编译之后,报错如下:

    DCMM.C:134:5: error: no match for call to ‘(const dimensionedScalar {aka const Foam::dimensioned<double>}) (Foam::IOobject, const Foam::fvMesh&)’
         );
    

    通过error所说,目前感觉是不是应该 对CSW添加一些定义 或者声明呢?

    但自己目前对代码不是很熟悉,还请哪位朋友指点一下 或者 提供一些类似的代码参考呢?



  • @小考拉 我一般是在求解器代码里写输出程序例如pisoFoam.C里加输出程序,没在湍流模型里面写过。你可以试试能不能在求解器程序里输出



  • @Samuel-Tu 求解器里面用info输出吗?有办法能输出到单独的文件里面吗?



  • @cxzhmg 搜我的贴子,OF文件读写


Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2