CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Relative flux in pimpleDyMFoam (http://www.cfd-online.com/Forums/openfoam/90795-relative-flux-pimpledymfoam.html)

Igor_2011 July 20, 2011 18:50

Relative flux in pimpleDyMFoam
 
Hi Foamers!

I've recently been trying to simulate the plunge motion of a 2D cylinder using pimpleDyMFoam and the rigid body deformation technique, or solidBodyMotionFvMesh. Although the simulations converge, I noticed that the entire flow solution moved with the cylinder, which is not very physical!

I started to think about this issue and the first thing that came out to my mind was that there may have an issue with the part of the code that should make the flow relative to the mesh motion. However, when I looked at the files (see the code below) everything looked correct to me since at the beginning of each iteration the fluxes are made absolute, then the mesh position is updated before make the flux relative again.

Any one has a clue regarding this issue?

Great thanks!


Code:



    // Make the fluxes absolute
        fvc::makeAbsolute(phi, U);

        #include "setDeltaT.H"

        runTime++;

        Info<< "Time = " << runTime.timeName() << nl << endl;

        mesh.update();

        if (mesh.changing() && correctPhi)
        {
            #include "correctPhi.H"
        }

        // Make the fluxes relative to the mesh motion
        fvc::makeRelative(phi, U);

        if (mesh.changing() && checkMeshCourantNo)
        {
            #include "meshCourantNo.H"
        }

        // --- PIMPLE loop
        for (int ocorr=0; ocorr<nOuterCorr; ocorr++)
        {
            if (nOuterCorr != 1)
            {
                p.storePrevIter();
            }

            #include "UEqn.H"

            // --- PISO loop

            for (int corr=0; corr<nCorr; corr++)
            {
                rAU = 1.0/UEqn.A();

                U = rAU*UEqn.H();
                phi = (fvc::interpolate(U) & mesh.Sf());

                if (p.needReference())
                {
                    fvc::makeRelative(phi, U);
                    adjustPhi(phi, U, p);
                    fvc::makeAbsolute(phi, U);
                }

                for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
                {
                    fvScalarMatrix pEqn
                    (
                        fvm::laplacian(rAU, p) == fvc::div(phi)
                    );

                    pEqn.setReference(pRefCell, pRefValue);

                    if
                    (
                        ocorr == nOuterCorr-1
                    && corr == nCorr-1
                    && nonOrth == nNonOrthCorr)
                    {
                        pEqn.solve(mesh.solver(p.name() + "Final"));
                    }
                    else
                    {
                        pEqn.solve(mesh.solver(p.name()));
                    }

                    if (nonOrth == nNonOrthCorr)
                    {
                        phi -= pEqn.flux();
                    }
                }

                #include "continuityErrs.H"

                // Explicitly relax pressure for momentum corrector
                if (ocorr != nOuterCorr-1)
                {
                    p.relax();
                }

                // Make the fluxes relative to the mesh motion
                fvc::makeRelative(phi, U);

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

            turbulence->correct();
        }



All times are GMT -4. The time now is 08:24.