output value vs paraFoam?



  • 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.


Log in to reply
 

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