CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Problems adding volScalarField to rhoCentralFoam (http://www.cfd-online.com/Forums/openfoam-programming-development/111860-problems-adding-volscalarfield-rhocentralfoam.html)

cryple January 16, 2013 21:06

Problems adding volScalarField to rhoCentralFoam
 
Dear all,

I thought I would be standing in front of just a little problem, when I wanted to add some run-tim-calculated fields to the rhoCentralFoam solver. :(

I would like to calculate e.g. mach number on-the-fly for some easier sampling and so added following to the createFields.H (testet on wedge15Ma5 tutorial):

Code:

volScalarField Ma
(
    IOobject
    (
        "Ma",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mag(U)/sqrt(1.4/psi)
);

The result is a file "Ma" in the run time folders, which has a uniform dimensionless internal field of 5.000001 in it, whereas the boundary "obstacle" is comprising of a nonuniform list of 80 scalars.

I want that nonuniform list of scalars for my internal field. What am I doing wrong? :confused:

Thanks in advance!
Best
Daniel

gschaider January 17, 2013 05:12

Quote:

Originally Posted by cryple (Post 402330)
Dear all,

I thought I would be standing in front of just a little problem, when I wanted to add some run-tim-calculated fields to the rhoCentralFoam solver. :(

I would like to calculate e.g. mach number on-the-fly for some easier sampling and so added following to the createFields.H (testet on wedge15Ma5 tutorial):

Code:

volScalarField Ma
(
    IOobject
    (
        "Ma",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    mag(U)/sqrt(1.4/psi)
);

The result is a file "Ma" in the run time folders, which has a uniform dimensionless internal field of 5.000001 in it, whereas the boundary "obstacle" is comprising of a nonuniform list of 80 scalars.

I want that nonuniform list of scalars for my internal field. What am I doing wrong? :confused:

Thanks in advance!
Best
Daniel

You've calculated the field for the initial conditions. To have the current state written out you've got to update it at the end of the timestep (something like "Ma=mag(U)/sqrt(1.4/psi);"

More elegant (without the modification of the solver) would be a functionObject

cryple January 17, 2013 06:18

Thanks a lot for your fast reply, gschaider.

I realised that actualy what I did, was just create an IOobject at the beginning of the solver run, without taking care of performing any calculation for Ma !inside! the time loop at all... :D

I also thought about using functionObjects, which would be much better, I think but I can't find any documentation on the possibilities and options I have there.

I will post the solution when I got more into it.

Thanks again!
Daniel


All times are GMT -4. The time now is 01:03.