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

OpenFoam basic

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2006, 21:25
Default In the OpenFoam, following few
  #1
liton
Guest
 
Posts: n/a
In the OpenFoam, following few lines are very common for variable declearation.

IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ, // or NO_READ
IOobject::AUTO_WRITE // or NO_WRITE
),
mesh

In third argument, there is a term "mesh", what does this mean with respect to the variable "T". Also at the end the same "mesh" term. sometimes, this position there is some calculations like 2/3*p+... . Finally, "IOobject::MUST_READ", what does this reply. Does some one have time to explain me these very basic terms.

Liton
  Reply With Quote

Old   December 10, 2006, 17:14
Default Hello Liton, to reuse your ex
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Hello Liton,
to reuse your example, I will consider the case of a temperature field, for which the full declaration is:
<pre>
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ, // or NO_READ
IOobject::AUTO_WRITE // or NO_WRITE
),
mesh
);
</pre>

A volScalarField actually is a geometricField of scalars, so the constructors used are the same for them both.
You can find them here: http://foam.sourceforge.net/doc/Doxygen/html/de/d5c/classFoam_1_1GeometricField. html

A common way to declare a field when you want to read it from a file at the beginning (or restart) of a calculation is to use IOobject and the mesh, as done before.

In such a case, you need to set IOobject::MUST_READ, to make OpenFOAM read it at construction time.

If you don't want to read the field from a file, but just declare it, and initialize it to something, you can use this syntax:
<pre>
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE // or NO_WRITE
),
3/2*alpha*beta
);
</pre>
with IOobject::NO_READ. Alpha and beta are others volScalarField and you initialize the field to the value of 3/2*alpha*beta.

"T" -> is the name of the file on the disk from/to which OpenFOAM will read/write. Usually it's the same of the variable.

IOobject::AUTO_WRITE -> automatically saves the field at write time (for example, ever a predetermined number of iterations, set in the controlDict of the simulation case).

IOobject::NO_WRITE -> never writes the field to a file.

I hope this helps.

Regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto 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
OpenFoam vs CFX5 mass balance in OpenFoam tangd OpenFOAM Running, Solving & CFD 33 May 23, 2010 17:36
Help for Basic UDF....... vijayaragavan FLUENT 3 February 15, 2008 23:45
[blockMesh] CheckMesh error using a tutorial from OpenFOAM 114 with openFOAM 13 martapajon OpenFOAM Meshing & Mesh Conversion 7 January 21, 2008 13:52
OpenFOAM users in Munich OpenFOAM benutzer in M%c3%bcnchen jaswi OpenFOAM 0 August 3, 2007 14:11
A new Howto on the OpenFOAM Wiki Compiling OpenFOAM under Unix mbeaudoin OpenFOAM Installation 2 April 28, 2006 09:54


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