Difference between revisions of "InterFoam"

From OpenFOAMWiki
m
Line 9: Line 9:
 
*[http://openfoam.cfd-online.com/forum/messages/1/135.html?1106532619|Inlet in interFoam]
 
*[http://openfoam.cfd-online.com/forum/messages/1/135.html?1106532619|Inlet in interFoam]
 
*[http://openfoam.cfd-online.com/forum/messages/1/135.html?1106532619|Question about interface flow and adaptive mesh]] In this thread Henry Weller explains how interFoam is different from the CICSAM  method.
 
*[http://openfoam.cfd-online.com/forum/messages/1/135.html?1106532619|Question about interface flow and adaptive mesh]] In this thread Henry Weller explains how interFoam is different from the CICSAM  method.
 +
 +
// Version Openfoam 1.5
 +
<cpp>
 +
#include "fvCFD.H"
 +
#include "MULES.H"
 +
#include "subCycle.H"
 +
#include "interfaceProperties.H"
 +
#include "twoPhaseMixture.H"
 +
 +
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 +
 +
int main(int argc, char *argv[])
 +
{
 +
// these header files contain source code for common tasks that are used in numerous applications.
 +
    #include "setRootCase.H"// set the run directory
 +
    #include "createTime.H" // rootPath, caseName
 +
    #include "createMesh.H" // timeName
 +
    #include "readEnvironmentalProperties.H"
 +
    #include "readPISOControls.H"
 +
    #include "initContinuityErrs.H"
 +
    #include "createFields.H"
 +
    #include "readTimeControls.H"
 +
    #include "correctPhi.H"
 +
    #include "CourantNo.H"
 +
    #include "setInitialDeltaT.H"
 +
 +
 +
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 +
 +
    Info<< "\nStarting time loop\n" << endl;
 +
 +
// use the runTime object to control time stepping
 +
    while (runTime.run())
 +
    {
 +
        #include "readPISOControls.H"
 +
        // Read nCorrectors, nNonOrthogonalCorrectors, momentumPredictor,
 +
        //  fluxGradp, transSonic, nOuterCorrectors
 +
        #include "readTimeControls.H"
 +
        // Read adjustTimeStep, maxCo, maxDeltaT
 +
        #include "CourantNo.H"
 +
        // Get the Mean and max Courant Numbers
 +
        #include "setDeltaT.H"
 +
        // Get the deltaT
 +
 +
        runTime++;
 +
 +
        Info<< "Time = " << runTime.timeName() << nl << endl;
 +
 +
        // Re-calculate the interface curvature by calculateK()
 +
        twoPhaseProperties.correct();
 +
 +
        #include "gammaEqnSubCycle.H"
 +
        // Read nGammaCorr, nGammaSubCycles
 +
 +
        #include "UEqn.H"
 +
 +
        // --- PISO loop
 +
        for (int corr=0; corr<nCorr; corr++)
 +
        {
 +
            #include "pEqn.H"
 +
        }
 +
 +
        #include "continuityErrs.H"
 +
 +
        p = pd + rho*gh;
 +
 +
        runTime.write();
 +
 +
        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
 +
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
 +
            << nl << endl;
 +
    }
 +
 +
    Info<< "End\n" << endl;
 +
 +
    return(0);
 +
}
 +
 +
 +
// ************************************************************************* //
 +
 +
</cpp>

Revision as of 07:12, 5 January 2009

InterFoam is a solver for 2 incompressible fluids, which tracks the interface and includes the option of mesh motion.

1 Related information in the web

1.1 Online discussion

// Version Openfoam 1.5

 
#include "fvCFD.H"
#include "MULES.H"
#include "subCycle.H"
#include "interfaceProperties.H"
#include "twoPhaseMixture.H"
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
int main(int argc, char *argv[])
{
// these header files contain source code for common tasks that are used in numerous applications.
    #include "setRootCase.H"// set the run directory 
    #include "createTime.H" // rootPath, caseName
    #include "createMesh.H" // timeName
    #include "readEnvironmentalProperties.H"
    #include "readPISOControls.H"
    #include "initContinuityErrs.H"
    #include "createFields.H"
    #include "readTimeControls.H"
    #include "correctPhi.H"
    #include "CourantNo.H"
    #include "setInitialDeltaT.H"
 
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
    Info<< "\nStarting time loop\n" << endl;
 
// use the runTime object to control time stepping
    while (runTime.run())
    {
        #include "readPISOControls.H"
        // Read nCorrectors, nNonOrthogonalCorrectors, momentumPredictor,
        //  fluxGradp, transSonic, nOuterCorrectors
        #include "readTimeControls.H"
        // Read adjustTimeStep, maxCo, maxDeltaT
        #include "CourantNo.H"
        // Get the Mean and max Courant Numbers 
        #include "setDeltaT.H"
        // Get the deltaT
 
        runTime++;
 
        Info<< "Time = " << runTime.timeName() << nl << endl;
 
        // Re-calculate the interface curvature by calculateK()
        twoPhaseProperties.correct();
 
        #include "gammaEqnSubCycle.H"
        // Read nGammaCorr, nGammaSubCycles
 
        #include "UEqn.H"
 
        // --- PISO loop
        for (int corr=0; corr<nCorr; corr++)
        {
            #include "pEqn.H"
        }
 
        #include "continuityErrs.H"
 
        p = pd + rho*gh;
 
        runTime.write();
 
        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
 
    Info<< "End\n" << endl;
 
    return(0);
}
 
 
// ************************************************************************* //