|
[Sponsors] |
December 2, 2014, 03:55 |
Output interval for probe and cuttingplanes
|
#1 |
New Member
Simon Johansson
Join Date: Sep 2011
Posts: 15
Rep Power: 15 |
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 |
|
Tags |
#codestream, functionobjects, probe function, write control |
|
|