|
[Sponsors] |
July 21, 2007, 19:35 |
Dear OpenFoam users
Can so
|
#1 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
Dear OpenFoam users
Can somebody explain what does runTime.write() does. I tried to look for the write() member function in Time.H but couldn't find any. Where can i find the corresponding peace of code !!!!!! Any help is greatly appreciated With Best Regards Jaswinder |
|
July 22, 2007, 02:53 |
Hi Jaswinder,
Did you use d
|
#2 |
New Member
Martin Karlsson
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 13
Rep Power: 17 |
Hi Jaswinder,
Did you use doxygen? Maybe you can find something on: http://foam.sourceforge.net/doc/Doxy...e-members.html Regards, Martin |
|
July 22, 2007, 07:00 |
Not too difficult. runTime is
|
#3 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
Not too difficult. runTime is class type Time:
db/Time/Time.H which is derived from objectRegistry, which is in turn derived from regIOobject: db/objectRegistry/objectRegistry.H db/regIOobject/regIOobject.H regIOobject has got a fiunction called write() and a virtual function writeObject: //- Write using given format, version and compression virtual bool writeObject ( IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp ) const; //- Write using setting from DB virtual bool write() const; Clearly, write is just a wrapper around writeData. This one is over-ridden for objectRegistry and reads: bool objectRegistry::writeObject ( IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp ) const { bool ok = true; for (const_iterator iter = begin(); iter != end(); ++iter) { if (objectRegistry::debug) { Pout<< "objectRegistry::write() : " << "Considering writing object " <<>name() <<>writeOpt() << endl; if (iter()->writeOpt() != NO_WRITE) { ok = iter()->writeObject(fmt, ver, cmp) && ok; } } return ok; }} Thus: loop over all objects registred in the object registry and offer them to write themselves. Each object will decide if it wants to do so, based on the settings, eg. NO_WRITE or AUTO_WRITE. Clear? Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
July 22, 2007, 09:05 |
Thanks Hrv
It couldn't be
|
#4 |
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 18 |
Thanks Hrv
It couldn't be explained any better :-). Answer from the source itself is ought to be clear. Thanks Regards Jaswinder |
|
January 12, 2008, 14:22 |
hi,
i would appreciate it i
|
#5 |
Senior Member
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17 |
hi,
i would appreciate it if somebody could explain how the lagrangian data is writen. i could not find the place where dieselspray or cloud are included into the "objectRegistry" so that their data is written. thanks in advance stephan |
|
June 28, 2010, 04:32 |
write dataFile
|
#6 |
New Member
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 17 |
Hi at all,
I have a problem with using runTime.write(). I like to write a dataFile only at every writeInterval. The data File contains the position of a flame at every time step. In order to avoid gaps or repetitions in the data-file after a stop in the simulation, the data-file should only be written when the rest of the data is stored to. I tried it with if(runTime.write()) { myStream<<...... } but this does not work right. Is there anybody how knows what to do? Thanks a lot in advance, Victor |
|
June 28, 2010, 05:35 |
|
#7 |
New Member
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 17 |
ok, it seems that runTime.write() is the problem! Sorry!
|
|
July 28, 2010, 11:04 |
|
#8 |
New Member
Join Date: Jun 2010
Posts: 14
Rep Power: 16 |
Hi all!
I'd like to create files every writeInterval (and which have the name of the corresponding writeInterval). I think I have to use runTime.write() or ofstream, but on this last case, it needs a const char argument (impossible to change/increment the file name). Anybody have any ideas on how to solve this? Thanks a lot in advance! Maxime |
|
July 28, 2010, 15:24 |
|
#9 |
Senior Member
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 255
Rep Power: 22 |
Hi Maxime,
you can use Code:
if (runTime.outputTime()) # include "write.H" When you want to write a volVectorField or volScalarField, the time steps path name is added automatically, so you get your data in different directories, but with the same file name: Code:
// write pressure in [Bar]: volScalarField p ( IOobject ( "p[Bar]", // the file name runTime.timeName(), // path to current time step mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), rho_*pd/scalar(100000) ); // explicitly write now: p.write(); Code:
fileName casePath = cwd(); Info << "casePath: " << casePath << endl; fileName caseName = casePath.name(); Info << "caseName: " << caseName << endl; fileName myFile = caseName + "_" + runTime.timeName() + ".csv"; Code:
{ OFstream *myStreamPtr = NULL; myStreamPtr = new OFstream(myFile); *myStreamPtr << "Valuable information..." << endl; } Code:
OFstream *myStreamPtr = NULL; if (Pstream::master()) { myStreamPtr = new OFstream(myFile); *myStreamPtr << "Plenty of information" << endl; } ... other code, master is collecting data with reduce or Pstream ... if (Pstream::master()) { *myStreamPtr << "Information collected from slaves" << endl; } |
|
August 2, 2010, 08:33 |
|
#10 |
New Member
Robert
Join Date: Apr 2010
Posts: 16
Rep Power: 16 |
Hi Martin,
I want to implement a transient boundary conditions, hence I need boundaryData file under constant. However, the problem is the property that I want to vary with time is dimensionedScalar (No_Read in CreateFields.H) instead of volScalarField. What can I do to implement this? What Q value should I put in the constant/transportProperties. I have tried to put this in the solver, but doesn't work. if (runTime.value() > 500) { Q = 600; } else { Q = 0; } Suggestions will be very much appreciated. Thanks in advance. Robert |
|
August 3, 2010, 06:53 |
Timw Varying B.C.
|
#11 |
Senior Member
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18 |
Hi Robert
There is some timeVarying... boundary condition in src/finiteVolume/fields/fvPatchFields/derived. May be one of them be useful for you. Best regards Good luck Ata |
|
November 27, 2014, 12:42 |
|
#12 |
New Member
minoominaii
Join Date: Nov 2014
Posts: 7
Rep Power: 12 |
hi
what is writeinterval??? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can someone explain the Y plus value | jeff bennet | Main CFD Forum | 32 | April 8, 2020 06:58 |
Can someone please explain this | jaswi | OpenFOAM | 2 | July 3, 2007 09:19 |
Please explain | Abby | CFX | 1 | April 25, 2006 07:18 |
can some one explain this to me? | docsri | Main CFD Forum | 2 | December 11, 2002 22:43 |
someone can explain this..... | mazza | Phoenics | 0 | June 4, 2001 12:59 |