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

How to compile an unsteady solver based on solver of MRFSimpleFoam?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 27, 2010, 11:16
Default How to compile an unsteady solver based on solver of MRFSimpleFoam?
  #1
Member
 
任芸
Join Date: Jun 2009
Posts: 75
Rep Power: 8
renyun0511 is on a distinguished road
hi all ,
i had a problem several days ago,but i can't resolve it yet.so i hope someone here would help me,thanks in advance!
the problem is:
As we know,the MRFSimpleFoam solver of OpenFOAM can't be done with unsteady flow,so i just add a PISO loop to modify it to unsteady solver. but from the picture of residuals which result from the modified solver,it appeared the result of steady solver does.
i don't know where is the error.would someone help me?
the modified code file is :
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RASModel/RASModel.H"
#include "MRFZones.H"
#include "IFstream.H"
#include "OFstream.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 "readPISOControls.H"
# include "CourantNo.H"
// Pressure-velocity SIMPLE corrector
{
// Momentum predictor
tmp<fvVectorMatrix> UEqn
( fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
);
mrfZones.addCoriolis(UEqn());
UEqn().relax();
solve(UEqn() == -fvc::grad(p));
//PISO loop
for (int corr=0;corr<nCorr;corr++)
{
volScalarField rAU = 1.0/UEqn().A();

U = rAU*UEqn().H();

phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU,U,phi);

adjustPhi(phi, U, p);

p.boundaryField().updateCoeffs();

mrfZones.relativeFlux(phi);

// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Momentum corrector
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
}
}
turbulence->correct();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return(0);
}

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


regards!
renyun0511 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pressure based and Density based Solver Xobile Main CFD Forum 18 April 13, 2015 07:49
2D Unsteady Potential Flow Solver A.S. Main CFD Forum 2 November 16, 2005 04:38
Pressure Based Coupled Solver A.S. Main CFD Forum 0 August 23, 2005 00:18
nUMECA UNSTEADY SOLVER dimitris Main CFD Forum 1 May 16, 2001 10:28
Matlab Unsteady 1D Euler Solver??? Johan Sylwander Main CFD Forum 1 May 24, 2000 15:26


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