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

Output interval for probe and cuttingplanes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2014, 03:55
Default Output interval for probe and cuttingplanes
  #1
New Member
 
Simon Johansson
Join Date: Sep 2011
Posts: 15
Rep Power: 15
Simjoh is on a distinguished road
Hi all,
I've just started to learn OpenFOAM and learn a lot through the post in this forum. Tank you all.

Now I want to contribute a little myself or get feedback on my solution to a problem I found.

The problem:
I'm running a quite large mesh and I do not want to save the fields of U and P over the whole volume at a short timestep. But probe and export cuttingplanes at a high frequency.
The settings in my controlDict are:
writeControl runTime;
writeInterval 1;

with these settings I cannot control the outputInterval in my cuttingplane and probe functions of the value to be at a interval of a fraction of the value writeInterval in controldict. Only integer multiple. Only option to get the output at a higer frequency then specified in controlDict is to use timeStep. But I want to control the same way as in my controlDict but setting the writeInterval to 0.01;

Solution:
I used the #codeStream to solve this. But please tell me if there are any nicer way to do it. To make the code easier to read I commented it a little there are also some outputs to terminal that I found helpful
getting used to C++.


Remove the outputInterval YOURINTEGER;
and repalce with

outputInterval #codeStream
{
code
#{
double deltaT=$deltaT; // Get the delta t at the current step
//label tt = max(2,dT);
//double rat;
double dtOutput =0.02; //How often samples should be made
cout << "test" << deltaT << " \n"; //Testoutput
double ratio = (dtOutput/deltaT); //calculate Line not needed
cout << "test" << ratio << " \n"; //Testoutput Line not needed
int n = int(dtOutput/deltaT); // Make to integer
cout << "test" << n << " \n"; //Testoutput
os << n;
#};
};


The code might seem a little messy for all advanced users. But as a beginner I found it useful to have some outputs while I'm working/learning. Especially when I had no knowledge of C++ before starting with this. Of course the code should be simplified when it's working as you like.


/Simon
Simjoh is offline   Reply With Quote

Reply

Tags
#codestream, functionobjects, probe function, write control


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



All times are GMT -4. The time now is 06:17.