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

Why is field not being written?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 12, 2012, 08:54
Default Why is field not being written?
  #1
Member
 
Florian
Join Date: Nov 2009
Posts: 59
Rep Power: 7
Horus is on a distinguished road
Hello,

I have a function object (coded function object embeddd in controlDict) that calculates c_p for the entire field.

The function object execution is controlled by:
Code:
      outputControl   outputTime;
      outputInterval  1;
The field is declared like this:
Code:
volScalarField c_p
        (
          IOobject
          (
           "c_p",
           mesh().time().timeName(),
           mesh(),
           IOobject::NO_READ,
           IOobject::AUTO_WRITE
           ),
          (p - p_inf) / (0.5 * sqr(U_inf))
         );
In this case it is never written to the timestep directories. If I add a c_p.write() it is written like it should.

But why is not written without an explicit write even though AUTO_WRITE is set? The U and p fields are declared just like this.

Thanks,

Florian
Horus is offline   Reply With Quote

Old   September 12, 2012, 10:16
Default
  #2
Senior Member
 
Hisham's Avatar
 
Hisham El Safti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 247
Blog Entries: 10
Rep Power: 8
Hisham is on a distinguished road
Hello,

If your field is not needed inside the calculations (not explicitly updated, i.e. using code). You can try adding the following at the end of your time loop:

Code:
if (runTime.outputTime())
  {
     volScalarField c_p
        (
          IOobject
          (
           "c_p",
           runTime().timeName(),
           mesh(),
           IOobject::NO_READ,
           IOobject::AUTO_WRITE
           ),
          (p - p_inf) / (0.5 * sqr(U_inf))
         );

    runTime.write();

  }
Regards
Hisham
Hisham 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
funkySetBoundaryFields - Manipulation of existing field jhertel OpenFOAM Pre-Processing 15 March 19, 2015 09:42
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
problems after decomposing for running alessio.nz OpenFOAM 5 April 20, 2011 08:44
Zero size field taranov OpenFOAM Bugs 2 April 20, 2010 04:51
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51


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