CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Reading a volScalarField from File (http://www.cfd-online.com/Forums/openfoam-solving/60563-reading-volscalarfield-file.html)

schnitzlein June 28, 2005 11:49

Is it possible to read in a vo
 
Is it possible to read in a volScalarfield from a
data file (in the constant directory) during the run and if yes, how can this be achieved?

Thanks in advance.

henry June 28, 2005 11:55

Yes, instead of say vol
 
Yes, instead of say

volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

use

volScalarField p
(
IOobject
(
"p",
"constant",
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);

schnitzlein June 29, 2005 04:56

Thank you very much for your h
 
Thank you very much for your help. Originally I replaced runTime.timeName() by runTime.constant(). The results are identical.

I set up the file defining the field beginning with:

dimensions [...];

internalField
nonuniform (
.. here the values are inserted
)

What I know is that I have to insert the values for the interior cells. But, in what order? And how do they relate to the cells and their indices, respectively.

I would like to specify the values in the same ordering as for the cells (polyMesh/cells). Is it possible? Is there a chance to define the values for the entire mesh, not only for the internal and boundary fields, e.g. by using a different keyword, e.g. Field ...?

hjasak June 29, 2005 05:01

Come on, this is trivial: the
 
Come on, this is trivial: the list of values is in the same order as the list of cells: first value into first cell, second value into a second cell etc. Anything else would be madness.

Hrv

P.S. For future reference, think about your problems: if it is logical, it is probably right!

hjasak June 29, 2005 05:03

BTW, before you ask, the same
 
BTW, before you ask, the same applies for points, edges, faces, faces in patch etc.

Hrv


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