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

checkerboard pressure and velocity field

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2013, 18:04
Default checkerboard pressure and velocity field
  #1
New Member
 
Join Date: Oct 2012
Posts: 16
Rep Power: 13
pascool is on a distinguished road
Hi foamers,

I'm computing the periodic flow through a ribbed duct. To achieve the desired flow rate, I coupled simpleFoam and channelFoam as follows:

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

    while (simple.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;

        // --- Pressure-velocity SIMPLE corrector

        // U equation--------------------------------------------------------------------------------------------

       // Momentum predictor

       tmp<fvVectorMatrix> UEqn
       (
           fvm::div(phi, U)
         + turbulence->divDevReff(U)
         ==
           flowDirection*gradP
       );

       UEqn().relax();

       sources.constrain(UEqn());

       solve(UEqn() == -fvc::grad(p));

      // p equation ---------------------------------------------------------------------------------------------
    

          p.boundaryField().updateCoeffs();

          volScalarField rAU(1.0/UEqn().A());
          U = rAU*UEqn().H();
          UEqn.clear();

          phi = fvc::interpolate(U, "interpolate(HbyA)") & mesh.Sf();
          adjustPhi(phi, U, p);

          // Non-orthogonal pressure corrector loop
          while (simple.correctNonOrthogonal())
          {
              fvScalarMatrix pEqn
              (
                  fvm::laplacian(rAU, p) == fvc::div(phi)
              );

              pEqn.setReference(pRefCell, pRefValu             pEqn.solve();

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

          #include "continuityErrs.H"

          // Explicitly relax pressure for momentum corrector
          p.relax();

         // Momentum corrector
          U -= rAU*fvc::grad(p);
          U.correctBoundaryConditions();
          sources.correct(U);

          turbulence->correct();

      // Correct driving force for a constant mass flow rate

      // Extract the velocity in the flow direction
      dimensionedScalar magUbarStar =
            (flowDirection & U)().weightedAverage(mesh.V());

      // Calculate the pressure gradient increment needed to
      // adjust the average flow-rate to the correct value
      dimensionedScalar gragPplus =
          (magUbar - magUbarStar)/rAU.weightedAverage(mesh.V());
       U += flowDirection*rAU*gragPplus;

       gradP += gragPplus;

       Info<< "Uncorrected Ubar = " << magUbarStar.value() << tab
           << "pressure gradient = " << gradP.value() << endl;

       runTime.write();

       #include "writeGradP.H"

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

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

    return 0;
}
The code works, but I get a strange checkerboard pattern.



Has anybody an idea where it may come from and how I could remedy this issue? I already tried different meshes.

Any help appreciated!!!
Best,
Pascal
pascool is offline   Reply With Quote

Old   April 1, 2013, 18:13
Default
  #2
New Member
 
Join Date: Oct 2012
Posts: 16
Rep Power: 13
pascool is on a distinguished road
The mentioned checkerBoard pattern:
Attached Images
File Type: jpg checkerBoard.jpg (37.6 KB, 227 views)
pascool is offline   Reply With Quote

Old   March 8, 2018, 05:10
Default Similar checkerboard velocity field
  #3
Member
 
Thomas Flint
Join Date: Jan 2016
Posts: 60
Rep Power: 10
tom_flint2012 is on a distinguished road
Hi,

I am seeing similar behaviour in my custom solver, did you ever get to the bottom of this?

All the best,

Tom
tom_flint2012 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
How to get the velocity field from the pressure field Hermano Main CFD Forum 2 November 29, 2011 09:32
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 03:15
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 03:13
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13


All times are GMT -4. The time now is 22:28.