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

how to combine parts of MRFSimpleFoam and TurbFoam to create a new solver?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2010, 23:10
Default how to combine parts of MRFSimpleFoam and TurbFoam to create a new solver?
  #1
Member
 
任芸
Join Date: Jun 2009
Posts: 75
Rep Power: 17
renyun0511 is on a distinguished road
hello all,
i am trying to combine parts of MRFSimpleFoam and TurbFoam to create a new solver.but i have some trouble. can someone help me ?
the following code is the new code modified based on MRFSimpleFOAM:
#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
// 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);
}

// ************************************************** *********************** //
I set 1200 steps. after calculation, i saw the redifual seems like a steady residual result from steady solver.why?
thanks in advance!
renyun0511 is offline   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
Model runs in icoFoam amp turbFoam but never in MRFSimpleFoam peter_watson OpenFOAM Running, Solving & CFD 0 April 1, 2008 10:02


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