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/)
-   -   IOobject and IOfield in OpenFoam (http://www.cfd-online.com/Forums/openfoam-solving/58989-ioobject-iofield-openfoam.html)

xiao April 2, 2008 21:56

Hi all, The IO in openfoam
 
Hi all,

The IO in openfoam seems to be complicated for me. I have been struggling for a while. Any hint on the following questions would be greatly appreciated.

1. The follow statement is from the file "CreateFile.H". Where did the code was "told" to find the suitable file and read the values for pressure from the right file? Is this the so called "demandDrivenData"?

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

2. Related to the question above, the following function is from "solidParticleIO.C". Does the statement

IOField<scalar> d(fieldIOobject("d"), np);

also create a field from a file? What data does the object "d" contain?

Thanks very much!

----------------------------
void Cloud<solidparticle>::writeFields() const
{
label np = size();

IOField<scalar> d(fieldIOobject("d"), np);
IOField<vector> U(fieldIOobject("U"), np);

label i = 0;
for
(
Cloud<solidparticle>::const_iterator iter = begin();
iter != end();
++iter, ++i
)
{
const solidParticle& p = iter();

d[i] = p.d_;
U[i] = p.U_;
}

d.write();
U.write();
}

};
----------------------------
The function "fieldIOobject" is a member function of "Cloud", defined in CloudIO.C:

template<class>
IOobject Cloud<particletype>::fieldIOobject(const word& fieldName) const
{
return IOobject
(
fieldName,
polyMesh_.time().timeName(),
"lagrangian",
polyMesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
}


All times are GMT -4. The time now is 15:54.