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/)
-   -   interFoam vs multiphaseInterFoam: differences in the structure of function calling (https://www.cfd-online.com/Forums/openfoam-programming-development/217674-interfoam-vs-multiphaseinterfoam-differences-structure-function-calling.html)

mrishi May 21, 2019 05:45

interFoam vs multiphaseInterFoam: differences in the structure of function calling
 
I am looking for the ways in which interFoam and eulerFoam have been extended to their multiphase counterparts.



More specifically, I am looking at the geometric VOF algorithm isoAdvector which has been integrated as an alternative to MULES for two-phase interFoam (available as interFlow with option to switch between the two methods). I am interested in the extension of this to environment with more than two phases, which is where my question comes in.



I am trying to go through the two source codes side-by-side to draw analogy and contrast, but would also appreciate any suggestions, thoughts and pointers to resources from the more experienced members of the community on this.


eg. the nature of mixture is contained in multiphaseMixture class vs incompressibleTwoPhaseMixture which supposedly derives from twoPhaseMixture. The first of these has member functions for calculating flux but the latter only returns the effective kinematic viscosity. I suppose this change becomes necessary to tackle multiple "secondary" phases which have been added?


The implementations have some subtle differences in the PIMPLE loop:


multiphaseInterFoam has this

Code:

  while (pimple.loop())
        {

            if (pimple.firstIter() || moveMeshOuterCorrectors)

            {

                scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();

 

                mesh.update();

 

                if (mesh.changing())

                {

                    Info<< "Execution time for mesh.update() = "

                        << runTime.elapsedCpuTime() - timeBeforeMeshUpdate

                        << " s" << endl;

 

                    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"

                    }

                }

            }

 

            mixture.solve();

            rho = mixture.rho();

While, corresponding loop for interFoam goes:
Code:

        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"      //where does this bit go in the other code


            #include "alphaEqnSubCycle.H"

 

            mixture.correct();                //we have only correct() in two-phase setup while the multiphase counterpart instead goes for solve() and rho recalculation., but there is a correct() counterpart as well, what does that do?


 

            if (pimple.frozenFlow())          //where does this bit go in the other code


            {

                continue;

            }

I would really appreciate any help in understanding the reasoning behind these differences in the way these functions are called and why it was necessary to put it this way.



Apologies if these seem like noob queries but I have not been able to find suitable explanations or documentation in this respect.


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