CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   how to add correct( ) in Foam.C to update functions? (https://www.cfd-online.com/Forums/openfoam-programming-development/171827-how-add-correct-foam-c-update-functions.html)

popovich May 17, 2016 22:28

how to add correct( ) in Foam.C to update functions?
 
Dear members, my functins rho1() rho2() p() are as follows:

virtual const volScalarField& rho1() const
{
return alpha1_.db().lookupObject<volScalarField>("rho1");
}

virtual const volScalarField& rho2() const
{
return alpha2_.db().lookupObject<volScalarField>("rho2");
}

virtual const volScalarField& p() const
{
return alpha1_.db().lookupObject<volScalarField>("p");
}



Foam.C are as follows:


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

while (runTime.run())
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"

runTime++;

Info<< "Time = " << runTime.timeName() << nl << endl;

// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
            
    #include "alphaEqnsSubCycle.H"
// correct interface on first PIMPLE corrector
if (pimple.corr() == 1)
{
interface.correct();
}

solve(fvm::ddt(rho) + fvc::div(rhoPhi));

#include "UEqn.H"
#include "TEqn.H"

// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}

if (pimple.turbCorr())
{
turbulence->correct();
}
}

runTime.write();

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

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

return 0;
}

popovich May 17, 2016 22:35

how to add correct() in Foam.C to update rho1() rho2() p() ?


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