CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

how to write temperature to a file

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By niaz
  • 1 Post By niaz

Reply
 
LinkBack Thread Tools Display Modes
Old   July 26, 2012, 08:47
Default how to write temperature to a file
  #1
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
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
samiam1000 is offline   Reply With Quote

Old   July 26, 2012, 16:12
Default
  #2
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
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 likes this.
niaz is offline   Reply With Quote

Old   July 27, 2012, 06:35
Default
  #3
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
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
samiam1000 is offline   Reply With Quote

Old   July 27, 2012, 09:38
Default
  #4
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 118
Rep Power: 8
niaz is on a distinguished road
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
samiam1000 likes this.
niaz is offline   Reply With Quote

Old   July 31, 2012, 10:40
Default
  #5
New Member
 
Join Date: Jul 2012
Posts: 21
Rep Power: 4
turbulencious is on a distinguished road
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
turbulencious is offline   Reply With Quote

Old   July 31, 2012, 10:42
Default
  #6
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
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?
samiam1000 is offline   Reply With Quote

Old   July 31, 2012, 11:05
Default
  #7
New Member
 
Join Date: Jul 2012
Posts: 21
Rep Power: 4
turbulencious is on a distinguished road
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
turbulencious is offline   Reply With Quote

Old   July 31, 2012, 11:29
Default
  #8
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
Is your outlet defined as a patch?
Could you copy your constant/polyMesh/boundary?

Thanks,
Samuele
samiam1000 is offline   Reply With Quote

Old   July 31, 2012, 11:39
Default
  #9
New Member
 
Join Date: Jul 2012
Posts: 21
Rep Power: 4
turbulencious is on a distinguished road
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;
    }
)
turbulencious is offline   Reply With Quote

Old   August 1, 2012, 02:49
Default
  #10
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
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?
samiam1000 is offline   Reply With Quote

Old   August 1, 2012, 03:49
Default
  #11
New Member
 
Join Date: Jul 2012
Posts: 21
Rep Power: 4
turbulencious is on a distinguished road
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
turbulencious is offline   Reply With Quote

Old   August 1, 2012, 03:50
Default
  #12
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
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
samiam1000 is offline   Reply With Quote

Old   August 1, 2012, 05:14
Default
  #13
New Member
 
Join Date: Jul 2012
Posts: 21
Rep Power: 4
turbulencious is on a distinguished road
I sent it! very nice of you!
turbulencious is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
1.7.x Environment Variables on Linux 10.04 rasma OpenFOAM Installation 9 July 30, 2010 04:43
mesh file for flow over a circular cylinder Ardalan Main CFD Forum 6 April 17, 2010 23:40
Paraview command not found hardy OpenFOAM Paraview & paraFoam 7 September 18, 2008 04:59
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise mbeaudoin OpenFOAM Installation 20 June 17, 2008 06:43
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 04:23.