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/)
-   -   A question on interDyMFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/130571-question-interdymfoam.html)

GerhardHolzinger February 28, 2014 12:55

A question on interDyMFoam
 
I have a question to the following piece of code taken from interDyMFoam.C of OpenFOAM-2.2.x.

In the curly braces the variable Urel is declared and used inside the if-statement.

Where is Urel used in this solver?
It is neither passed to any method as an argument nor should it be accessible outside the block within the curly braces. So, of what use is Urel?


Code:

        scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();

        {
            // Calculate the relative velocity used to map the relative flux phi
            volVectorField Urel("Urel", U);

            if (mesh.moving())
            {
                Urel -= fvc::reconstruct(fvc::meshPhi(U));
            }

            // Do any mesh changes
            mesh.update();
        }

        if (mesh.changing())
        {


deepsterblue February 28, 2014 14:28

As the comment suggests, a relative flux field is calculated internally by dynamicRefineFvMesh for mapping purposes.
When the mesh changes, all fields in the registry (including the Urel field) are mapped auto-magically.

GerhardHolzinger March 1, 2014 04:34

Hi, thanks for the answer.
What is still not clear to me is, where Urel is used. As it is declared within this block I assume it is not in use before this block.

To me it seems that Urel is nowhere used, but probably I am just confused.

cnsidero March 4, 2015 13:39

It's created simply for recomputing the fluxes on the newly refined mesh. In the dynamicMeshDict, under the correctFluxes entry you'll find a list of pairs. Those are mappings of the velocity fields to the fluxes. Since the flux phi is relative to mesh motion, it needs a relative velocity mapped to it. Since a relative velocity isn't stored anywhere else, it's computed where you point out. That's all Urel is used for.


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