数值风云

关于在icoFoam添加重力场遇到的问题

因为各种原因,需要在icoFoam里添加重力场以实现模拟自然循环,使用的版本为OF9。
添加了传热,重力场,以及外热源后,跑了方腔算例验证了下,但是发现在上下边界附近的网格速度不正常,有很大的Y方向速度,但是其他区域的速度看起来很正常,如下图,想请问各位前辈会是什么样得到原因导致的呢?代码贴在下方,希望各位前辈不吝赐教,不胜感激!

Q,g单位均处理过,rho无量纲

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "pisoControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
    #include "setRootCaseLists.H"
    #include "createTime.H"
    #include "createMesh.H"

    pisoControl piso(mesh);

    #include "createFields.H"
    #include "initContinuityErrs.H"
      int ixx;
      double   ttt[50000];
      double   r[50000];

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nStarting time loop\n" << endl;
    
    while (runTime.loop())
    {    
     
            ixx=0;
	forAll(T, cellI)
	{
	
	 ixx++;
	 ttt[ixx]=T[cellI];
	 r[ixx]=11112.0-1.375*ttt[ixx];
	 rho[cellI]=r[ixx];
	 //Info<<rho[ixx]<<endl;
           	      
	}
	
        Info<< "Time = " << runTime.timeName() << nl << endl;

        #include "CourantNo.H"

        // Momentum predictor
      
        fvVectorMatrix UEqn
        (
           fvm::ddt(rho,U)
          +rho*fvm::div(phi, U)
          -rho*fvm::laplacian(nu, U)-rho*g
          /*fvm::ddt(U)
          +fvm::div(phi, U)
          -fvm::laplacian(nu, U)*/
        );

        if (piso.momentumPredictor())
        {
            solve(UEqn == -fvc::grad(p));
        }

        // --- PISO loop
        while (piso.correct())
        {
            volScalarField rAU(1.0/UEqn.A());
            volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
            surfaceScalarField phiHbyA
            (
                "phiHbyA",
                fvc::flux(HbyA)
              + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
            );

            adjustPhi(phiHbyA, U, p);

            // Update the pressure BCs to ensure flux consistency
            constrainPressure(p, U, phiHbyA, rAU);

            // Non-orthogonal pressure corrector loop
            while (piso.correctNonOrthogonal())
            {
                // Pressure corrector

                fvScalarMatrix pEqn
                (
                    fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
                );

                pEqn.setReference(pRefCell, pRefValue);

                pEqn.solve();

                if (piso.finalNonOrthogonalIter())
                {
                    phi = phiHbyA - pEqn.flux();
                }
            }

            #include "continuityErrs.H"

            U = HbyA - rAU*fvc::grad(p);
            U.correctBoundaryConditions();
           
        }
        
        

        fvScalarMatrix TEqn
        (
            fvm::ddt(T)
            + fvm::div(phi, T)
            - fvm::laplacian(DT, T)
            - Q
            
        );

        TEqn.solve();
        
        
       

        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
            
	
	
    }

	
    Info<< "End\n" << endl;

    return 0;
}


// ************************************************************************* //