|
[Sponsors] |
July 26, 2012, 09:47 |
how to write temperature to a file
|
#1 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
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 |
|
July 26, 2012, 17:12 |
|
#2 |
Senior Member
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17 |
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 |
|
July 27, 2012, 07:35 |
|
#3 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
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 |
|
July 27, 2012, 10:38 |
|
#4 |
Senior Member
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17 |
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 |
|
July 31, 2012, 11:40 |
|
#5 |
New Member
Join Date: Jul 2012
Posts: 21
Rep Power: 14 |
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 |
|
July 31, 2012, 11:42 |
|
#6 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
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 ); } Then you'll have a file with the temperature! Does this help? |
|
July 31, 2012, 12:05 |
|
#7 |
New Member
Join Date: Jul 2012
Posts: 21
Rep Power: 14 |
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 |
|
July 31, 2012, 12:29 |
|
#8 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Is your outlet defined as a patch?
Could you copy your constant/polyMesh/boundary? Thanks, Samuele |
|
July 31, 2012, 12:39 |
|
#9 |
New Member
Join Date: Jul 2012
Posts: 21
Rep Power: 14 |
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; } ) |
|
August 1, 2012, 03:49 |
|
#10 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
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 ); } } |
|
August 1, 2012, 04:49 |
|
#11 |
New Member
Join Date: Jul 2012
Posts: 21
Rep Power: 14 |
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 |
|
August 1, 2012, 04:50 |
|
#12 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
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 |
|
August 1, 2012, 06:14 |
|
#13 |
New Member
Join Date: Jul 2012
Posts: 21
Rep Power: 14 |
I sent it! very nice of you!
|
|
May 30, 2019, 07:52 |
Update for OFv6
|
#14 |
Senior Member
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 9 |
This is a very old thread. But maybe this will help someone else save a few minutes. For OF v6 following works very well.
Add this to controlDict: Code:
functions { outletData { type surfaceFieldValue; libs ("libfieldFunctionObjects.so"); writeControl timeStep; writeInterval 1; log yes; writeTotalArea no; writeFields no; regionType patch; //faceZone; name outlet; operation areaAverage; fields ( p T U ); } }; |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mesh file for flow over a circular cylinder | Ardalan | Main CFD Forum | 7 | December 15, 2020 14:06 |
1.7.x Environment Variables on Linux 10.04 | rasma | OpenFOAM Installation | 9 | July 30, 2010 05:43 |
[OpenFOAM] Paraview command not found | hardy | ParaView | 7 | September 18, 2008 05:59 |
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise | mbeaudoin | OpenFOAM Installation | 20 | June 17, 2008 07:43 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |