Difference between revisions of "InterFoam"

From OpenFOAMWiki
(Related information in the web)
(Momentum Equation)
Line 41: Line 41:
 
     \frac{ \partial (\rho {u}_i)}{\partial t} + \frac{\partial}{\partial x_j} \left( \rho {u}_j u_i \right) =  
 
     \frac{ \partial (\rho {u}_i)}{\partial t} + \frac{\partial}{\partial x_j} \left( \rho {u}_j u_i \right) =  
  
   - \frac{\partial p} {\partial{x_i}}  + \frac{\partial}{\partial x_j} \left( \tau_{ij} + \tau_{t_{ij}} \right) + \rho g_i + \sigma_i,
+
   - \frac{\partial p} {\partial{x_i}}  + \frac{\partial}{\partial x_j} \left( \tau_{ij} + \tau_{t_{ij}} \right) + \rho g_i + f_{\sigma i},
  
 
</math></center>
 
</math></center>
Line 47: Line 47:
  
 
<math> u </math> represent the velocity, <math> g_i </math> the gravitational acceleration, <math> p </math> the pressure and  
 
<math> u </math> represent the velocity, <math> g_i </math> the gravitational acceleration, <math> p </math> the pressure and  
<math> \tau_{ij}  </math> and <math> \tau_{t_{ij}}  </math> are the viscose and turbulent stresses. <math> \sigma_i </math> is the
+
<math> \tau_{ij}  </math> and <math> \tau_{t_{ij}}  </math> are the viscose and turbulent stresses. <math> f_{\sigma i}, </math> is the
 
surface tension.
 
surface tension.
  
Line 63: Line 63:
 
<math> \alpha </math> is 1 inside fluid 1 with the density  <math> \rho_1 </math> and 0 inside fluid 2 with the density <math> \rho_2  </math>. At the interphase between
 
<math> \alpha </math> is 1 inside fluid 1 with the density  <math> \rho_1 </math> and 0 inside fluid 2 with the density <math> \rho_2  </math>. At the interphase between
 
the two fluids <math> \alpha </math> varies between 0 and 1.
 
the two fluids <math> \alpha </math> varies between 0 and 1.
 +
 +
The surface tension <math> f_{\sigma i}, </math> is modelled as continuum surface force (CSF)<ref>Brackbill, J. U., Douglas B. Kothe, and Charles Zemach. "A continuum method for modeling surface tension." Journal of computational physics 100.2 (1992): 335-354. </ref>. It is calculated as follows (see also <ref> Heyns, Johan A., and Oliver F. Oxtoby. "Modelling surface tension dominated multiphase flows using the VOF approach." 6th European Conference on Computational Fluid Dynamics. 2014. </ref>):
 +
 +
<center><math>
 +
 +
  f_{\sigma i} = \sigma \kappa \frac{\partial \alpha }{\partial x_i}
 +
 +
</math></center>
 +
 +
<math> \sigma </math> is the surface tension constant and <math> \kappa </math> the curvature. The curvature can be approximated as follows <ref>Brackbill, J. U., Douglas B. Kothe, and Charles Zemach. "A continuum method for modeling surface tension." Journal of computational physics 100.2 (1992): 335-354. </ref> and <ref> Heyns, Johan A., and Oliver F. Oxtoby. "Modelling surface tension dominated multiphase flows using the VOF approach." 6th European Conference on Computational Fluid Dynamics. 2014. </ref>:
 +
 +
<center><math>
 +
 +
\kappa = - \frac{\partial n_i}{\partial x_i} = - \frac{\partial}{\partial x_i} \left (  \frac{\partial \alpha / \partial x_i}{|\partial \alpha / \partial x_i|}\right )
 +
 +
</math></center>
  
 
===Equation for the interphase ===
 
===Equation for the interphase ===

Revision as of 20:19, 23 September 2018

InterFoam Solver for 2 incompressible, isothermal immiscible fluids using a VOF

   (volume of fluid) phase-fraction based interface capturing approach,
   with optional mesh motion and mesh topology changes including adaptive
   re-meshing.


1 Related information in the web

1.1 Online discussion

1.2 Useful links

An overview about interfoam: http://infofich.unl.edu.ar/upload/3be0e16065026527477b4b948c4caa7523c8ea52.pdf

2 Equations

The solver solves the Navier Stokes equations for two incompressible, isothermal immiscible fluids. That means that the material properties are constant in the region filled by one of the two fluid except at the interphase.

2.1 Continuity Equation

The constant-density continuity equation is



   \frac{\partial {u}_j}{\partial x_j} = 0
(1)

2.2 Momentum Equation



    \frac{ \partial (\rho {u}_i)}{\partial t} + \frac{\partial}{\partial x_j} \left( \rho {u}_j u_i \right) = 

   - \frac{\partial p} {\partial{x_i}}  + \frac{\partial}{\partial x_j} \left( \tau_{ij} + \tau_{t_{ij}} \right) + \rho g_i + f_{\sigma i},
(2)

 u represent the velocity,  g_i the gravitational acceleration,  p the pressure and  \tau_{ij}  and  \tau_{t_{ij}}  are the viscose and turbulent stresses.  f_{\sigma i}, is the surface tension.


The density  \rho is defined as follows:



   \rho = \alpha  \rho_1 + (1 - \alpha)  \rho_2
(3)

 \alpha is 1 inside fluid 1 with the density  \rho_1 and 0 inside fluid 2 with the density  \rho_2  . At the interphase between the two fluids  \alpha varies between 0 and 1.

The surface tension  f_{\sigma i}, is modelled as continuum surface force (CSF)[1]. It is calculated as follows (see also [2]):



   f_{\sigma i} = \sigma \kappa \frac{\partial \alpha }{\partial x_i}

 \sigma is the surface tension constant and  \kappa the curvature. The curvature can be approximated as follows [3] and [4]:



\kappa = - \frac{\partial n_i}{\partial x_i} = - \frac{\partial}{\partial x_i} \left (  \frac{\partial \alpha / \partial x_i}{|\partial \alpha / \partial x_i|}\right )

2.3 Equation for the interphase

In order to know where the interphase between the two fluids is, an additional equation for  \alpha has to be solved.



 \frac{\partial \alpha}{\partial t}  +  \frac{\partial ( \alpha {u}_j )}{\partial x_j} = 0
(4)

The equation can be seen as the conservation of the mixture components along the path of a fluid parcel.

3 Source Code

\\OpenFOAM 6

3.1 interFoam.C


 
 
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "CMULES.H"
#include "EulerDdtScheme.H"
#include "localEulerDdtScheme.H"
#include "CrankNicolsonDdtScheme.H"
#include "subCycle.H"
#include "immiscibleIncompressibleTwoPhaseMixture.H"
#include "turbulentTransportModel.H"
#include "pimpleControl.H"
#include "fvOptions.H"
#include "CorrectPhi.H"
#include "fvcSmooth.H"
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
int main(int argc, char *argv[])
{
    #include "postProcess.H"
 
    #include "setRootCaseLists.H"
    #include "createTime.H"
    #include "createDynamicFvMesh.H"
    #include "initContinuityErrs.H"
    #include "createDyMControls.H"
    #include "createFields.H"
    #include "createAlphaFluxes.H"
    #include "initCorrectPhi.H"
    #include "createUfIfPresent.H"
 
    turbulence->validate();
 
    if (!LTS)
    {
        #include "CourantNo.H"
        #include "setInitialDeltaT.H"
    }
 
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    Info<< "\nStarting time loop\n" << endl;
 
    while (runTime.run())
    {
        #include "readDyMControls.H"
 
        if (LTS)
        {
            #include "setRDeltaT.H"
        }
        else
        {
            #include "CourantNo.H"
            #include "alphaCourantNo.H"
            #include "setDeltaT.H"
        }
 
        runTime++;
 
        Info<< "Time = " << runTime.timeName() << nl << endl;
 
        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            if (pimple.firstIter() || moveMeshOuterCorrectors)
            {
                mesh.update();
 
                if (mesh.changing())
                {
                    // Do not apply previous time-step mesh compression flux
                    // if the mesh topology changed
                    if (mesh.topoChanging())
                    {
                        talphaPhi1Corr0.clear();
                    }
 
                    gh = (g & mesh.C()) - ghRef;
                    ghf = (g & mesh.Cf()) - ghRef;
 
                    MRF.update();
 
                    if (correctPhi)
                    {
                        // Calculate absolute flux
                        // from the mapped surface velocity
                        phi = mesh.Sf() & Uf();
 
                        #include "correctPhi.H"
 
                        // Make the flux relative to the mesh motion
                        fvc::makeRelative(phi, U);
 
                        mixture.correct();
                    }
 
                    if (checkMeshCourantNo)
                    {
                        #include "meshCourantNo.H"
                    }
                }
            }
 
            #include "alphaControls.H"
            #include "alphaEqnSubCycle.H"
 
            mixture.correct();
 
            #include "UEqn.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;
}
 
 
// ************************************************************************* //


Cite error: <ref> tags exist, but no <references/> tag was found