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

Steady incompressible laminar flow using simpleFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 29, 2008, 16:28
Default Someone posted a message about
  #1
yongshenglian
Guest
 
Posts: n/a
Someone posted a message about using simpleFoam to solve steady incompressible flow problem. I just cannot find it anymore.

After reading some papers and posted messages here, I made a new solver based on simpleFoam. It took me a while to compile the solver but finally I have the executable file. However, the solution is always wrong. The velocity is more than 100 times of the inlet velocity over a channel.

I checked my code and compare with simpleFoam. It does not seem that the code is wrong. I also check the boundary condition and initial condition. IF I run PISO, it gives good result.

I post the code here. Hopefully someone can correct me.

Thanks.

*************************

#include "fvCFD.H"
//#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
//#include "incompressible/RASModel/RASModel.H"

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

int main(int argc, char *argv[])
{

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

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

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

for (runTime++; !runTime.end(); runTime++)
{
Info<< "Time = " << runTime.timeName() << nl << endl;

# include "readSIMPLEControls.H"
# include "initConvergenceCheck.H"

p.storePrevIter();

// Solve the Momentum equation

tmp<fvvectormatrix> UEqn
(
fvm::div(phi, U)
+ fvm::laplacian(nu,U)
);

UEqn().relax();

eqnResidual = solve
(
UEqn() == -fvc::grad(p)
).initialResidual();

maxResidual = max(eqnResidual, maxResidual);

// pressure correction
p.boundaryField().updateCoeffs();

volScalarField AU = UEqn().A();
U = UEqn().H()/AU;
UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);

// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(1.0/AU, p) == fvc::div(phi)
);

pEqn.setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
eqnResidual = pEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
}
else
{
pEqn.solve();
}

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

# include "continuityErrs.H"

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

// Momentum corrector
U -= fvc::grad(p)/AU;
U.correctBoundaryConditions();


runTime.write();
# include "convergenceCheck.H"
}

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

return(0);
}


// ************************************************** *********************** //
  Reply With Quote

Reply


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
SimpleFoam as Newtonian laminar flow solver titio OpenFOAM Running, Solving & CFD 2 March 8, 2013 05:44
Steady state incompressible flow Bharat Rangan (Rangan) OpenFOAM Running, Solving & CFD 10 November 22, 2010 16:21
Incompressible laminar poiseuille flow samarth OpenFOAM Running, Solving & CFD 20 July 13, 2010 04:38
SimpleFoam for laminar flow hsing OpenFOAM Running, Solving & CFD 3 April 14, 2005 15:39
incompressible steady flow john Main CFD Forum 0 May 9, 2003 09:24


All times are GMT -4. The time now is 19:04.