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

AUTO_WRITE and field updating

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 8, 2013, 14:34
Default AUTO_WRITE and field updating
  #1
New Member
 
Pierre Le Fur
Join Date: Jan 2013
Posts: 2
Rep Power: 0
Pierre Le Fur is on a distinguished road
Hello all,

I have been puzzled by the a simple question about a field defined say in createFields.H as:

Code:
volScalarField rho
       (
            IOobject
            (
                "rho",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),

            thermo->rho()
       );
Assuming that the thermo used is based on basicPsiThermo.
If in the solver, rho as defined here is not updated or touched in anyway by calling thermo->correct somewhere or by explicitly modifying it,
but is still used in solved equations i.e. momentum, pressure equations etc.... Will the field "rho" used in these solved equations be modified everytime time step due to its definition in createFields?
As far as I figure, when it is written in the time folder it will be evaluated and updated as thermo->rho(), which in this case might be "rho = P/RT",
In other words is there a difference between the values of the field "rho" used in the solver and the "rho" written down?

Any help would be appreciated.

Cheers
Pierre Le Fur is offline   Reply With Quote

Old   April 8, 2013, 22:22
Default
  #2
Member
 
Chris L
Join Date: Sep 2012
Posts: 53
Rep Power: 13
vbchris is on a distinguished road
I'm not sure I completley understand but from my experience (somewhat limited). This code is a one-time creation of a volScalarField object. Thermo is used to point to a structure that has a member called rho (I assume this is used to calc rho of of the ideal gas law?). These values are used to populate the volScalarField rho. So... Without putting my foot in my mouth, I would say unless its modified in the time loop it shouldn't change.
vbchris is offline   Reply With Quote

Old   April 9, 2013, 03:03
Default
  #3
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 250
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Chris is totally right. With such a deffinition you create a copy of the data and that does not change unless you explicitly update it with something like "rho = ...". If you would like to connect variable rho with current thermo model data use a reference:

volScalarField & rho = thermo->rho();

or something like that.

Cheers,
Alex
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   April 9, 2013, 07:18
Default
  #4
New Member
 
Pierre Le Fur
Join Date: Jan 2013
Posts: 2
Rep Power: 0
Pierre Le Fur is on a distinguished road
Thanks guys,

I did little tests last night to check the matter and indeed the field does not change and keeps the value set initially.

The question initially arose because some way or another, the density in the code I was working on was changing in mysterious ways... when, as I thought at the time, it wasn't supposed to. Eventually, I found the real culprit.... Me. I just can't see what's right in front of me.
Pierre Le Fur 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



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