|
[Sponsors] |
Read a vector list with IFstream and create IOobject from it |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 14, 2013, 10:30 |
Read a vector list with IFstream and create IOobject from it
|
#1 |
New Member
Marcel Vonlanthen
Join Date: Nov 2012
Location: Zurich, Switzerland
Posts: 28
Rep Power: 14 |
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 ) ); Code:
vectorField readU; fileName caseDir = "path/to/my/Ufile" IFstream dataStream(caseDir/"U"); dataStream >> readU; |
|
October 9, 2017, 16:25 |
|
#2 |
New Member
Abiy Melaku
Join Date: Jul 2016
Location: Western University
Posts: 5
Rep Power: 10 |
Hello Marcel!
I am replying late because it took me 5 years to figure out the answer . In case if you are still looking for the answer, you can create IOField from already existing field as follows. Code:
IOField<vector> readUIO ( IOobject ( "readU", this->db().time().constant(), "boundaryData"/this->patch().name(), this->db(), IOobject::MUST_READ, IOobject::AUTO_WRITE, false ), readU ); |
|
|
|