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

Why is field not being written?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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: 16
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 Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
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

Old   February 13, 2023, 05:59
Default
  #3
New Member
 
simone tamaro
Join Date: Jan 2023
Posts: 2
Rep Power: 0
alabardati1918 is on a distinguished road
Hi guys


I had the same issue. I managed to solve it by realizing that I had used the value of the field in another file. I removed its use there and it now works.


Hope it helps
alabardati1918 is offline   Reply With Quote

Reply


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
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 04:49
funkySetBoundaryFields - Manipulation of existing field jhertel OpenFOAM Pre-Processing 16 May 18, 2020 06:32
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
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 06:51


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