CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Questions about data output

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 7 Post By marupio

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2010, 05:37
Default Questions about data output
  #1
New Member
 
yafuji aki
Join Date: Jul 2010
Location: Japan
Posts: 14
Rep Power: 16
aki_yafuji is on a distinguished road
Dear FOAMers,

I am now studying OpenFOAM by modifying some tutorials,
especially dam break tutorial by supposing the kEpsilon
model for turbulence.
I have a couple of questions about data output...
If you wouldn't mind, would you please give me some advice?


1. I could understand that when I want to control data output,
I should modify "createFields.H", but I am not sure the
description well.
For example, pressure "p" and density "rho" are written in
createFields.H as follows,

-----------------------------------------------------
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT
),
alpha1*rho1 + (scalar(1) - alpha1)*rho2,
alpha1.boundaryField().types()
);
-----------------------------------------------------

My question is what does "mesh" in p mean?
For rho, concrete descriptions
"alpha1*rho1 + (scalar(1) - alpha1)*rho2,
alpha1.boundaryField().types()"
are written instead of "mesh".


2. We can find turbulent viscosity: nut and Reynolds
stress tensor: R in kEpsilon.C.
Of them, nut is written in Constructors,

-----------------------------------------------------
nut_
(
IOobject
(
"nut",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
),
autoCreateNut("nut", mesh_)
)
{
nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_);
nut_.correctBoundaryConditions();

printCoeffs();
}
-----------------------------------------------------

on the other hand, R is written in Member Functions,

-----------------------------------------------------
tmp<volSymmTensorField> kEpsilon::R() const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
(
IOobject
(
"R",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
k_.boundaryField().types()
)
);
}
-----------------------------------------------------

As for nut (which is described in Constructors),
I can get its value at each time step when I add
"IOobject::AUTO_WRITE".
But I could not output R (which is described in
Member Functions), even if I use
"IOobject::AUTO_WRITE"
instead of
"IOobject::NO_WRITE".

What should I do when I want to output the Reynolds stress
tensor R (such as values that are written in Member Functions)?
I can not output R either even if I type "R" in post-processing.


3. I think "U" in OpenFOAM means the total velocity which is the sum of
mean and perturbation velocities.
Where are the mean velocity (UMean) and the perturbation velocity
(UPrime = U - UMean) in the code? I would like you to tell me
how you output the three components (i.e., x, y, and z components)
of both mean and perturbation velocities.


4. I would like to calculate potential energy: rho*g*x,
but I am not sure how the x-coordinate is stored in the code.
Would you please tell me how do you output the x-coordinate?


Maybe these question arises from a lack of understanding of C++,
it would give me a great deal of pleasure if you give me some
advice.

Thanks in advance!

aki
aki_yafuji is offline   Reply With Quote

Old   August 5, 2010, 09:33
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
hi friend you have too questions here
1. look following address you will find more about out put input to the openFoam
http://openfoamwiki.net/index.php/In...IOobject_class
nimasam is offline   Reply With Quote

Old   August 5, 2010, 12:22
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
Quote:
Originally Posted by aki_yafuji View Post
1. My question is what does "mesh" in p mean?
These are all constructors for volScalarField, which is a GeometricField. There are 13 different constructors defined for the GeometricField, and p is being created using this one:

Code:
        //- Construct and read given IOobject
        GeometricField
        (
            const IOobject&,
            const Mesh&
        );
The first argument is an IOobject, and is defined by:

Code:
        IOobject
        (
            "p",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        )
IOobjects are part of the objectRegistry system which is what OpenFOAM uses to manage its model-related data. As nima says there are good references on the wiki. Also check out:

http://openfoamwiki.net/index.php/Op...objectRegistry

The second argument is a reference to the mesh, which the GeometricField needs to build itself. There are no other arguments, so GeometricField looks in your case directory for the file [time]/p and reads this file.

On the other hand, rho is not (necessarily) defined in the case directory, rather it is derived from other variables. To accomplish this a different GeometricField constructor is used:

Code:
        //- Construct as copy resetting IO parameters and boundary types
        GeometricField
        (
            const IOobject&,
            const GeometricField<Type, PatchField, GeoMesh>&,
            const wordList& patchFieldTypes
        );
The first parameter is another IOobject. For the second parameter, we have:
Code:
alpha1*rho1 + (scalar(1) - alpha1)*rho2
This is the equation that is used to calculate the value for rho at every point. Lastly, is the patchField list:
Code:
alpha1.boundaryField().types()
Quote:
Originally Posted by aki_yafuji View Post
2. nut is written in Constructors, R is written in Member Functions

I can get the value for nut at each time step when I add
"IOobject::AUTO_WRITE".
But I could not output R (which is described in
Member Functions), even if I use
"IOobject::AUTO_WRITE"
instead of
"IOobject::NO_WRITE".

What should I do when I want to output the Reynolds stress
tensor R (such as values that are written in Member Functions)?
This is because R is transient (comes and goes), whereas nut is always in memory.

The changes you suggest above are to the turbulence model itself, part of the core of OpenFOAM. I'd recommend against changing these, as it will impact the behaviour of every solver in existence. I'd recommend changing the solver if anything.

I'm sure there's easier ways, but one thing you could try is adding another field to the end of createFields.H, such as:

Code:
    volSymmTensorField R
    (
        IOobject
        (
            "R",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ
            IOobject::AUTO_WRITE
        ),
        turbulence->R()
    );
Lastly, in your solver loop, just before runTime.write(), you have to update the field:
Code:
    R = turbulence->R();
Quote:
Originally Posted by aki_yafuji View Post
3. I think "U" in OpenFOAM means the total velocity which is the sum of
mean and perturbation velocities.
You are using a RAS turbulence model which is averaging already. The perturbed velocities are not directly calculated when using models such as k-epsilon. Their effect is accounted for using the turbulence model variables, such as nut, k and epsilon. That is not OpenFOAM specific, you should be able to find this in any information resource on turbulence modelling. Try looking for the eddy-viscosity hypothesis.

Quote:
Originally Posted by aki_yafuji View Post
4. I would like to calculate potential energy: rho*g*x,
but I am not sure how the x-coordinate is stored in the code.
Would you please tell me how do you output the x-coordinate?
Translating the text-file data output to usable data by coordinates is a pain. You should look into using the data sampling utility (sample), or I've heard the calculator in paraFoam isn't bad either.

Good luck!

-dave
marupio is offline   Reply With Quote

Old   September 9, 2010, 02:59
Default
  #4
New Member
 
yafuji aki
Join Date: Jul 2010
Location: Japan
Posts: 14
Rep Power: 16
aki_yafuji is on a distinguished road
I am so sorry to be late that I could not reply you sooner,
because I attended a training camp...

Dear nima,
Thank you for letting me know good references on the wiki.
I am not clear about hierarchy of codes yet, but I'll try to read
the reference until I figure it out.

Dear dave,
Thank you very much for all the advices and help you gave me!!
Your advices become informative guide to understand OpenFOAM!
I tried to modify the code based on your guide, some additional
questions are popped up. May I also know more about the way for
data output? It would make me very happy if you gave me more advices.

Q1.
Quote:
Originally Posted by marupio View Post
I'm sure there's easier ways, but one thing you could try is adding another field to the end of createFields.H, such as:

Code:
    volSymmTensorField R
    (
        IOobject
        (
            "R",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        turbulence->R()
    );
Lastly, in your solver loop, just before runTime.write(), you have to update the field:
Code:
    R = turbulence->R();
In accordance with your advice, I can obtain R data!
But, R file is written at each time step. (Other files such as p and U are written at
constant 'writeInterval' time step. On the other hand, although 'writeInterval' = 0.001,
every folders such as '0.000119048', '0.000260204', '0.000428132'... are created
and only R files are stored in them. )
If possible, please let me know if you can help in some other way to write R files
at constant 'writeInterval' time step, similar to other files such as p and U.



Q2.
Now I am using the standard kEpsilon solver.
The rate of turbulence energy production is defined in the 217 line from the top
in /src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C as 'G',
Code:
00217     volScalarField G("RASModel::G", nut_*2*magSqr(symm(fvc::grad(U_))));
I would like to output G at every 'writeInterval' time step, how should I modify kEpsilon.C?

It would be very helpful if you could give me some advices!

aki
aki_yafuji is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lift and drag on ship superstructures vaina74 OpenFOAM Running, Solving & CFD 3 June 8, 2010 13:30
CCOSILAB -- output data in Excel Format carlie Main CFD Forum 0 June 9, 2005 17:11
transiant simualtion, data output danny FLUENT 2 November 19, 2004 22:31
Help with DPM UDF for OUTPUT needed Zhengcai Ye FLUENT 0 January 5, 2004 17:58
where is output data file[PHOENICS] DSF Siemens 0 May 30, 2000 12:49


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