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/)
-   -   want to create volscalarField Object using just runTime Objects. (https://www.cfd-online.com/Forums/openfoam-programming-development/156325-want-create-volscalarfield-object-using-just-runtime-objects.html)

fedvasu July 7, 2015 17:44

want to create volscalarField Object using just runTime Objects.
 
Here is how we typically define, volScalarField Objects

Code:

mu_
    (
        IOobject
        (
            phasePropertyName("thermo:mu"),
            mesh.time().timeName(),
            mesh,

            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet(1, -1, -1, 0, 0)
    )

but we don't require mesh object to create IOobject, we may use runTime object of type Time,
Code:

mu_
    (
        IOobject
        (
            phasePropertyName("thermo:mu"),
          runTime.timeName(),
            runTime,

            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet(1, -1, -1, 0, 0)
    )

I want to know if we can forgo mesh object, in the next argument or maybe we can create an object of subtype of fvMesh class? something like this,

Code:

mu_
    (
        IOobject
        (
            phasePropertyName("thermo:mu"),
          runTime.timeName(),
            runTime,

            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        GeoMesh<runTime>,
        dimensionSet(1, -1, -1, 0, 0)
    )

is it possible? have you trued it before, my constraint is I don't have an object of type fvMesh readily available.

fedvasu August 4, 2016 14:06

Yes it is possible.

It is exactly as I have written.

runTime and mesh are derived from the same base class.


All times are GMT -4. The time now is 20:42.