CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Can somebody please explain runTimewrite

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

Like Tree9Likes
  • 4 Post By hjasak
  • 5 Post By MartinB

Reply
 
LinkBack Thread Tools Display Modes
Old   July 21, 2007, 18:35
Default Dear OpenFoam users Can so
  #1
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 9
jaswi is on a distinguished road
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
jaswi is offline   Reply With Quote

Old   July 22, 2007, 01:53
Default Hi Jaswinder, Did you use d
  #2
New Member
 
Martin Karlsson
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 13
Rep Power: 8
martin is on a distinguished road
Hi Jaswinder,

Did you use doxygen? Maybe you can find something on:

http://foam.sourceforge.net/doc/Doxy...e-members.html

Regards,
Martin
martin is offline   Reply With Quote

Old   July 22, 2007, 06:00
Default Not too difficult. runTime is
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,763
Rep Power: 21
hjasak will become famous soon enough
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
hjasak is offline   Reply With Quote

Old   July 22, 2007, 08:05
Default Thanks Hrv It couldn't be
  #4
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 9
jaswi is on a distinguished road
Thanks Hrv

It couldn't be explained any better :-). Answer from the source itself is ought to be clear.

Thanks

Regards
Jaswinder
jaswi is offline   Reply With Quote

Old   January 12, 2008, 14:22
Default hi, i would appreciate it i
  #5
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 8
stephan is on a distinguished road
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
stephan is offline   Reply With Quote

Old   June 28, 2010, 03:32
Default write dataFile
  #6
New Member
 
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 7
Victor is on a distinguished road
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
Victor is offline   Reply With Quote

Old   June 28, 2010, 04:35
Default
  #7
New Member
 
Victor Fleischer
Join Date: Nov 2009
Posts: 21
Rep Power: 7
Victor is on a distinguished road
ok, it seems that runTime.write() is the problem! Sorry!
Victor is offline   Reply With Quote

Old   July 28, 2010, 10:04
Default
  #8
New Member
 
Join Date: Jun 2010
Posts: 14
Rep Power: 7
maximeg is on a distinguished road
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
maximeg is offline   Reply With Quote

Old   July 28, 2010, 14:24
Default
  #9
Senior Member
 
Martin
Join Date: Oct 2009
Location: Aachen, Germany
Posts: 252
Rep Power: 11
MartinB is on a distinguished road
Hi Maxime,
you can use
Code:
    if (runTime.outputTime())
#    include "write.H"
to write additional information when a regular time step is written out. Just create a file "write.H" for your solver which handles the output.

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();
To create a filename (with time step in filename) for usage with ofstream take this code snippet as an example:
Code:
    fileName casePath = cwd();
    Info << "casePath: " << casePath << endl;
    fileName caseName = casePath.name();
    Info << "caseName: " << caseName << endl;
    fileName myFile = caseName
        + "_"
        + runTime.timeName()
        + ".csv";
To use a new filename every write interval and to close your stream just use curly brackets around your code:
Code:
    {
        OFstream *myStreamPtr = NULL;
        myStreamPtr = new OFstream(myFile);
        *myStreamPtr << "Valuable information..." << endl;
    }
To handle OFstream in parallel so that only the master writes data:
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;
    }
Martin
MartinB is offline   Reply With Quote

Old   August 2, 2010, 07:33
Default
  #10
New Member
 
Robert
Join Date: Mar 2010
Posts: 16
Rep Power: 7
rob3rt is on a distinguished road
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
rob3rt is offline   Reply With Quote

Old   August 3, 2010, 05:53
Default Timw Varying B.C.
  #11
ata
Senior Member
 
ata's Avatar
 
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 322
Rep Power: 9
ata is on a distinguished road
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
ata is offline   Reply With Quote

Old   November 27, 2014, 12:42
Default
  #12
New Member
 
minoominaii
Join Date: Nov 2014
Posts: 7
Rep Power: 2
bgane67 is on a distinguished road
hi
what is writeinterval???
bgane67 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone explain the Y plus value jeff bennet Main CFD Forum 17 April 1, 2014 14:34
Can someone please explain this jaswi OpenFOAM 2 July 3, 2007 08:19
Please explain Abby CFX 1 April 25, 2006 06: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 11:59


All times are GMT -4. The time now is 05:19.