CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Read a vector list with IFstream and create IOobject from it (http://www.cfd-online.com/Forums/openfoam-programming-development/119326-read-vector-list-ifstream-create-ioobject.html)

Sylv June 14, 2013 09:30

Read a vector list with IFstream and create IOobject from it
 
Dear foamer,

I want to use some cutting planes from a source case (generate by the runtime sampling tool) to feed the inlet of a target case. To do so, I use the BC timeVaryingMappedFixedValue at the inlet of my traget case.

Unfortunately, the foamFiles generated by the sampling tool have no header, thus I cannot read them directly with timeVaryingMappedFixedValue (TVMFV). So I decided to modify this BC.

for example, TVMFV reads U values from the file U with an IOobject (IOobject needs header):
Code:

IOField<point> samplePoints
        (
            IOobject
            (
                "points",
                this->db().time().constant(),
                "boundaryData"/this->patch().name(),
                this->db(),
                IOobject::MUST_READ,
                IOobject::AUTO_WRITE,
                false
            )
        );

I can read the U from the sampling tool with IFstream (does not need header):
Code:

vectorField readU;
fileName caseDir = "path/to/my/Ufile"
IFstream dataStream(caseDir/"U");
dataStream >> readU;

How can I reconstruct the IOobject in TVMFV with my vectorField "readU"? My question is similar to this post http://www.cfd-online.com/Forums/ope...-foamfile.html, but I still don't understand how to do it...


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