CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Writting fields separately

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 25, 2013, 05:43
Default Writting fields separately
  #1
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 15
JimKnopf is on a distinguished road
Hello there!

At the end of my calculation i create several (let's say 50 additional) volVectorFields from my solution and write them to the hard drive.

Right now I create a prtList<volVectorField> foo

and put all my vectorFields in there.

Code:
forAll(foo, fooI)
{
/* writte data to U field*/

  foo.set
    (
     fooI,
     new volVectorField
     (
      IOobject
      (
       "bar"+Foam::name(fooI),
       mesh.time().timeName(),
       mesh,
       IOobject::NO_READ,
       IOobject::AUTO_WRITE
       ),
      U
      )     
     );

}
Then data is written via runTime.write().

Well this works but it's very costly in terms of RAM. So is there a way to force the writing?

Like

0. compute field i
1. create field
2. write field
3. delete field
4. goto 0 and repeat

What I'm looking for ist a method "write this field now to time N".

Anyone got any idea?

Thanks and best regards
Jim
JimKnopf is offline   Reply With Quote

Old   January 25, 2013, 18:32
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17
kmooney is on a distinguished road
Hi Jim,

If I understand your question you could take the writing responsibilities from the runTime.write() call and take it into your own hands.

You could set the fields to be NO_WRITE instead of AUTO_WRITE when declaring the IOobject.

Then you can write on demand (and only when you demand) with:

Code:
if(runTime.write())
{
      fooI.write();
}
or without the IF conditional if you just want to write every timeStep.

Is that what you were looking for?
kmooney is offline   Reply With Quote

Old   January 26, 2013, 07:50
Default
  #3
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 16
Hisham is on a distinguished road
Quote:
Originally Posted by kmooney View Post
Hi Jim,

If I understand your question you could take the writing responsibilities from the runTime.write() call and take it into your own hands.

You could set the fields to be NO_WRITE instead of AUTO_WRITE when declaring the IOobject.

Then you can write on demand (and only when you demand) with:

Code:
if(runTime.write())
{
      fooI.write();
}
or without the IF conditional if you just want to write every timeStep.

Is that what you were looking for?
Hi

Adding to this, if you create the volFields inside the if(runTime.write()) block you can keep your RAM free until write time at which the Fields are created, written then deleted (automatically go out of scope).

Hisham
Hisham is offline   Reply With Quote

Old   January 28, 2013, 04:19
Default
  #4
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 15
JimKnopf is on a distinguished road
Hi,

thank you, that was what I was looking for. I just didn't find the write() method of the IOobject, although it's obvious.

Greets
Jim
JimKnopf is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time averaged fields on a defined time range Yann OpenFOAM Post-Processing 8 August 7, 2019 05:46
The mysterious _0 fields stevenvanharen OpenFOAM Running, Solving & CFD 2 January 4, 2011 08:24
Missing fields in reconstructPar flowris OpenFOAM 1 July 9, 2010 03:48
domainIntegrate, dieselFoam and Lagrangian Fields mturcios777 OpenFOAM 0 May 14, 2010 16:16
PostChannel maka OpenFOAM Post-Processing 5 July 22, 2009 10:15


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