CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

projectionFoam - ERROR.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 19, 2019, 09:13
Default projectionFoam - ERROR.
  #1
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 245
Rep Power: 10
gu1 is on a distinguished road
Hi,

I'm doing some tests on the algorithm created by Asim Onder and Johan Meyers (HPC realization of a controlled turbulent jet using OpenFOAM) and I'm finding some limitations and wanted help.
The impression I had is that the flow 'froze', is not advancing the timeStep. The image I attached below led me to believe this, as the average flow did not change.

Below is the code so you can comment. The reference article is easily accessible.
My intention was to use a method similar to that used in ANSYS (Fractional Step Method), but ''it does not exist in OpenFOAM'' (I did not find it yet), so I decided to test this method of projection.

OF5.0:
LINK or,
Code:
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
#include "pisoControl.H"
#include "fvOptions.H"

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

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

    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createControl.H"
    #include "createFields.H"
    #include "createFvOptions.H"
    #include "initContinuityErrs.H"

    turbulence->validate();

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

    Info<< "\nStarting time loop\n" << endl;

    while (runTime.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;
	
        #include "CourantNo.H"

        // Non-iterative projection scheme
        {
	    //linearization of convective flux using second order extrapolation  	  
	    surfaceScalarField phi_o(0.5*(3.0*phi.oldTime()-phi.oldTime().oldTime()));
	  
	    // Solve the Momentum equation

            //MRF.correctBoundaryVelocity(U);

            fvVectorMatrix UEqn
            (
                  fvm::ddt(U) 
                + fvm::div(phi_o, U)
               //+ MRF.DDt(U)
                + turbulence->divDevReff(U)
               ==
                fvOptions(U)
            );

            UEqn.relax();

            fvOptions.constrain(UEqn);

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

                fvOptions.correct(U);
             }
 
            // --- Projection step

	    dimensionedScalar dt=runTime.deltaT();
	    //scalar rDeltaT=1.0/dt.value(); //WARNING: Variable is not being used.
	    U += dt*fvc::grad(p);
	    U.correctBoundaryConditions();      
	    surfaceScalarField phi("phi", fvc::interpolate(U) & mesh.Sf());
            //MRF.makeRelative(phi);      
	    adjustPhi(phi, U, p);

            // Update the pressure BCs to ensure flux consistency
            //constrainPressure(p, U, phi, MRF); //ERROR.
	  
	    // Non-orthogonal pressure corrector loop
            while (piso.correctNonOrthogonal())
            {
                  // Pressure corrector

                  fvScalarMatrix pEqn
                  (
                        fvm::laplacian(dt, p) == fvc::div(phi)
                  );

                  pEqn.setReference(pRefCell, pRefValue);

                  pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));

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

            #include "continuityErrs.H"

	    U -= dt*fvc::grad(p);
	    U.correctBoundaryConditions();
            fvOptions.correct(U);
	}       
	
	laminarTransport.correct();
        turbulence->correct();

        runTime.write();

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

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

    return 0;
}

// ************************************************************************* //
I would be very happy if anyone can help with the code.


*About MRF: I commented in the code for not knowing if there would be need to use. I do not know what its function.
Attached Images
File Type: jpeg recort.jpeg (70.4 KB, 6 views)
gu1 is offline   Reply With Quote

Reply

Tags
openfoam 5.0, projection method


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 01:21
[blockMesh] blockMesh with double grading. spwater OpenFOAM Meshing & Mesh Conversion 92 January 12, 2019 10:00
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 10:17
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51


All times are GMT -4. The time now is 00:30.