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/)
-   -   Boundary condition cannot find volScalarField (https://www.cfd-online.com/Forums/openfoam-programming-development/131359-boundary-condition-cannot-find-volscalarfield.html)

ChrisA March 13, 2014 13:31

Boundary condition cannot find volScalarField
 
So I've added in non-constant gamma for the totalTemperature boundary condition by having it lookup a value from the solver (exactly the same way other boundary conditions look up say rho). I'm confident this implementation is correct because it's solving fine on my development machine.

However, when I drop the code onto our cluster the boundary condition cannot find Cp.

Code:

    request for volScalarField Cp from objectRegistry region0 failed
    available objects of type volScalarField are
21
(
...
alpha
...
)

Cp simply does not show up in the list. The declaration of Cp is identical to that of alpha (just shown as an example from createFields):

Code:

volScalarField alpha
(
    IOobject
    (
        "alpha",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
turbulence->alphaEff()
);

volScalarField Cp
(
    IOobject
    (
        "Cp",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
thermo.Cp()
);

I then update Cp at the start of my time loop.

It also does not work if I declare Cp at the start of the time loop:

Code:

    while (runTime.run())
    {
                volScalarField Cp = thermo.Cp();

I'm absolutely stumped as to why this is not working on the cluster but yet solving fine on my test machine. The version of OpenFoam is of course the same and the only difference is the compiler (the cluster uses Intel, whereas the test machine uses the OF native).

That said, there is absolutely no reason it shouldn't be able to find the volScalarField in the first place. Any ideas?

ChrisA March 18, 2014 17:17

So I got this to work. I think the solution outlines some underlying ignorance of mine with respect to the volScalarField class and the object registry. The way I got it to work was declaring Cp as:

Code:

volScalarField Cp
(
    IOobject
    (
        "Cp",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
mesh,
dimensionedScalar("Cp", dimensionSet(0,2,-2,-1,0), 1)
);

and then update the Cp value at the start of my time loop with Cp = thermo.Cp();

Maybe someone more knowledgeable can explain why the declaration above worked for alpha but not Cp and why this is necessary. If not I'm sure I'll be looking through the class one day and have an AHA moment.

How I managed to get it to run on my test machine is also a magical mystery, maybe someone updated a version somewhere without my knowledge.


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