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

OpenFoam basic

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 9, 2006, 20: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, 16:14
Default Hello Liton, to reuse your ex
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,880
Rep Power: 25
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

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
GeekoCFD 32bit - The 32bit edition of GeekoCFD.
GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats.
alberto 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
OpenFoam vs CFX5 mass balance in OpenFoam tangd OpenFOAM Running, Solving & CFD 33 May 23, 2010 16:36
Help for Basic UDF....... vijayaragavan FLUENT 3 February 15, 2008 22:45
CheckMesh error using a tutorial from OpenFOAM 114 with openFOAM 13 martapajon OpenFOAM Native Meshers: blockMesh 7 January 21, 2008 12:52
OpenFOAM users in Munich OpenFOAM benutzer in M%c3%bcnchen jaswi OpenFOAM 0 August 3, 2007 13:11
A new Howto on the OpenFOAM Wiki Compiling OpenFOAM under Unix mbeaudoin OpenFOAM Installation 2 April 28, 2006 08:54


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