CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Running, Solving & CFD

AUTO_WRITE and field updating

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

LinkBack Thread Tools Display Modes
Old   April 8, 2013, 14:34
Default AUTO_WRITE and field updating
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:

volScalarField 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.

Pierre Le Fur is offline   Reply With Quote

Old   April 8, 2013, 22:22
Chris L
Join Date: Sep 2012
Posts: 36
Rep Power: 5
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
Senior Member
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 214
Rep Power: 10
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.

Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Advanced Process Simulation of
Solidification and Melting"

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

Franz-Josef-Str. 18
A - 8700 Leoben
Österreich / Austria
Tel.: +43 3842 - 402 - 3125
makaveli_lcf is offline   Reply With Quote

Old   April 9, 2013, 07:18
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


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

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