CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   can someone explain IO in OpenFOAM (https://www.cfd-online.com/Forums/openfoam-programming-development/151145-can-someone-explain-io-openfoam.html)

cfdopenfoam April 5, 2015 01:30

can someone explain IO in OpenFOAM
 
greetings to all.

i am in great interest of OF and have walked through the two guides (i.e. UG and PG), as well as some basics of C++. and also, i have looked into some source code (e.g. icoFoam). however, i found that the IO operating is of great difficulties and i nearly could not handle its mechanisms. here is something always makes me confused:

(1) how does the runTime.write() works? i know runTime is an object of Class Time, but what about the function write()? how can i proceeding to that or add some code to that (if possible)?

(2)how are the classes related, Time, objectRegistry, IOdictionary, IOobject, regIOobject, runTimeSelectionTables, addToRunTimeSelectionTable etc? and if certain user-defined volScalarField p is intended to be written at every writeInterval, how should i make the implementation? add it to the createFields.H file? or if i want to output myStream into a file at every writeInterval/timeStep?

(3)i have went through the 'sample' utility. however, i think i should firstly overcome the two foregoing problems and then maybe i could develop mySample.

thanks for the attention. any suggestion (or materials about how to IO in OF) will make my life easier.

wyldckat April 5, 2015 06:56

Quick answer: http://openfoamwiki.net/index.php/OpenFOAM_guide

cfdopenfoam April 6, 2015 08:29

how to IO freewill in OF
 
Quote:

Originally Posted by wyldckat (Post 540002)

thank you very much, Bruno. the guide you offered really benefits me a lot and made my day.

just, the third consideration. if i want to output some simulation information to a file after simulation, such as something like the sample utility, i think first i should create a folder that may be named with 'samples' (but how?), and then read the time series by using functions such as runTime.setTime(), runTime.timeName() etc. but how could i write the information to a file located where expected?

may i get some guidelines (as what you have kindly offered) on freewill write (do not use the overridden writeData() function) or some simple developed-utility instances?

best regards,
Ykjh

wyldckat September 20, 2015 15:30

Greetings,

Sorry for the really late reply, but only now did I manage to take a quick look into your question.
And unfortunately I don't have a straight answer. I would need some more details in order to know what would be the best approach to suggest to you.
I say this because OpenFOAM relies in a modular approach, which is why the sample application relies on libraries that have the sampling code, while the application sample only handles the bureaucracy of loading the mesh and going through the necessary time steps.

On the other hand, if you simply want to output values, then perhaps the utility "applications/utilities/postProcessing/miscellaneous/pdfPlot" is one possible way to start.

Best regards,
Bruno


All times are GMT -4. The time now is 23:40.