Write scalar in file in every timeFolder
Dear Foam-Community,
i'd like to calculate the surface-area of the inlet-patch for a moving domain for every time step and write out the calculated value in a file in each time-folder. For now i have the following code: Code:
label inletPatchID = mesh.boundaryMesh().findPatchID("inlet"); Does anyone has any idea how to solve this? Regards, Martin |
You will have to change the filename, something like this?
Code:
std::ofstream file(runTime.timeName(),"inlet_area.txt"); You also have alternative solutions - Write to logfile (Info<<) and extract data afterwards from the log file (awk) - Use a function object. functionObjects run during run time. I am not sure if you can do this with the default ones, but with the swak functionObjects by Bernhard Gschaider you can obtain this information easily for sure. |
Dear Bernhard,
thank you very much for your answer. Unfortunately your hint did not work for me. The wmake-compiler gives out the following error: CarreauYasudaIcoFoam.C:91:59: error: no suitable function for calling »std::basic_ofstream<char>::basic_ofstream(Foam::w ord, const char [15])« the log-file hint migth work, although i'd really like to add it in the code. Martin |
The string concatenation is something I am not to sure about, this is something to dig into, maybe you could use something like "runTime.timeName().string()", but you wil have to experiment a bit.
|
All times are GMT -4. The time now is 18:10. |