CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   how to write temperature to a file (http://www.cfd-online.com/Forums/openfoam/105262-how-write-temperature-file.html)

samiam1000 July 26, 2012 08:47

how to write temperature to a file
 
Dear All,

I am running buoyantSimpleFoam and I would like to save the temperature of a patch (my_outlet) in a text file.

What I would like to do is to save either the sum ot the temperature of each cell (that belongs to the patch) or writing the temperature of the cells in a line.
In the first case I'll have a file with 1 column and n lines (with n = number of iterations), while in the second case I'll have a m x n file (where m = number of cell belonging to the patch).

How can I do this?

Any idea?

Thanks a lot,

Samuele

niaz July 26, 2012 16:12

you should use face object
just add these lines to control dict
functions
{
faceObj1
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");

enabled true;
outputControl outputTime;

// Output to log&file (true) or to file only
log true;

// Output field values as well
valueOutput true;

// Type of source: patch/faceZone/sampledSurface
source patch;

// if patch or faceZone: name of patch or faceZone
sourceName movingWall;

//// if sampledSurface: dictionary with a sampledSurface
//// Note: will not sample surface fields.
//sampledSurfaceDict
//{
// // Sampling on triSurface
// type sampledTriSurfaceMesh;
// surface integrationPlane.stl;
// source cells; // sample cells or boundaryFaces
// interpolate true;
//}

// Operation: areaAverage/sum/weightedAverage ...
operation areaAverage;

fields
(
p
phi // surface fields not supported for sampledSurface
U
);
}
this will write your patch value for each time steps solved

samiam1000 July 27, 2012 06:35

Dear Niaz,

thanks a lot for answering.

It really helped.

Just a question: do you know where I can find a list of available functions (probes, faceObj1..)?

Thanks a lot,
Samuele

niaz July 27, 2012 09:38

Dear sam
there are two functions which is helpful
1- src/sampling
2- src/postproceesing/functionobjects
in each folder you can find a controldict that show you how to use it

turbulencious July 31, 2012 10:40

hey guys,

this seems to be quite useful for me. Could you please make it a bit more clear, how exactly we set the commands for writing the Temperature in a file, as a function of time?
I tried to use the commands posted above but without success

thanks in advance

samiam1000 July 31, 2012 10:42

Just paste this code
Code:

functions
{
faceObj1
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");

enabled true;
outputControl outputTime;

// Output to log&file (true) or to file only
log true;

// Output field values as well
valueOutput true;

// Type of source: patch/faceZone/sampledSurface
source patch;

// if patch or faceZone: name of patch or faceZone
sourceName movingWall;

//// if sampledSurface: dictionary with a sampledSurface
//// Note: will not sample surface fields.
//sampledSurfaceDict
//{
// // Sampling on triSurface
// type sampledTriSurfaceMesh;
// surface integrationPlane.stl;
// source cells; // sample cells or boundaryFaces
// interpolate true;
//}

// Operation: areaAverage/sum/weightedAverage ...
operation areaAverage;

fields
(
T
);
}

in your system/controlDict.

Then you'll have a file with the temperature!

Does this help?

turbulencious July 31, 2012 11:05

hey Samuele, thanks a lot for your immediate response!

well, I pasted what you wrote but unfortunately it doesnt work. The only thing I have changed is the sourceName movingWall; and I entered the name of my outlet.

I get this message:

--> FOAM FATAL ERROR:

request for objectRegistry region0 from objectRegistry aplo1 failed
available objects of type objectRegistry are

3
(
fluid
pla1
pla2
)
From function objectRegistry::lookupObject<Type>(const word&) const
in file db/objectRegistry/objectRegistryTemplates.C at line 131.


where fluid, pla1, pla2 are the regions in my problem. (pla1 & pla2 are solid)

I would be really grateful if you help me through this.
cordially,
giorgos

samiam1000 July 31, 2012 11:29

Is your outlet defined as a patch?
Could you copy your constant/polyMesh/boundary?

Thanks,
Samuele

turbulencious July 31, 2012 11:39

hey Samuele,

thanks again for your consideration!

So, yes my outlet is defined as patch (it seems to work ok - the fluid is actually going out).

here is the constant/polyMesh/boundary
my outlet at this point is bottom (sometimes will be also the top)
akres-ar and akres_de are the solid walls outside of the domain
Code:

5
(
    akres_ar
    {
        type            wall;
        nFaces          80;
        startFace      10096;
    }
    akres_de
    {
        type            wall;
        nFaces          192;
        startFace      10176;
    }
    bottom
    {
        type            patch;
        nFaces          8;
        startFace      10368;
    }
    top
    {
        type            patch;
        nFaces          8;
        startFace      10376;
    }
    frontBack
    {
        type            empty;
        nFaces          10240;
        startFace      10384;
    }
)


samiam1000 August 1, 2012 02:49

Hi,

I try to write the system/controlDict for you.

You should add these lines, at the end:

Code:

functions
{
faceObj1
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");

enabled true;
outputControl outputTime;

log true;

valueOutput true;

source patch;

sourceName bottom;

// Operation: areaAverage/sum/weightedAverage ...
operation areaAverage;

fields
(
T
);
}
}

Which version of OF are you running?

turbulencious August 1, 2012 03:49

hey Samuele,

thanks again. Unfortunately, this didnt work also. It gives me the same message that I have posted earlier.

request for objectRegistry region0 from objectRegistry aplo1 failed
available objects of type objectRegistry are.......

I am using the latest version, OF-2.1.1

If you find an idea to solve this I will be really grateful...
ciao

samiam1000 August 1, 2012 03:50

Could you share your case with me?

I could test it and give it the solution (if I can find it!)..

Samuele

email: samuele.zampini@gmail.com

turbulencious August 1, 2012 05:14

I sent it! very nice of you!


All times are GMT -4. The time now is 02:25.