CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Output interval for probe and cuttingplanes

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

LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2014, 02:55
Default Output interval for probe and cuttingplanes
New Member
Simon Johansson
Join Date: Sep 2011
Posts: 15
Rep Power: 14
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;

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
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.

Simjoh is offline   Reply With Quote


#codestream, functionobjects, probe function, write control

Thread Tools Search this Thread
Search this Thread:

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

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