Hi Guys,
If I created an arr
Hi Guys,
If I created an array of volScalarFields with this syntax: PtrList<volscalarfield> fields(2); for (int i =0; i<2; i++) { word fieldName = "field" + Foam::name(i); Info<< "Reading field " << fieldName<< endl; fields.hook( volScalarField ( IOobject ( fieldName, runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ) ); } and then I solve some equation for these (two fields for now), at runtime runTime.write(); won´t print out these field values? Am I doing something wrong? Cheers, Radu |
- Is 'fields' still in scope b
- Is 'fields' still in scope by the time you call runTime.write() ?
- Do the fields actually get modified? (as far as I can remember only done by some field operators, e.g. assignment, solve) You can set the debug flag for objectRegistry to check if anything gets written |
Try adding before everything y
Try adding before everything you wrote
volVectorField* UmeanPtr; Radu |
The code already contains such
The code already contains such declaration. Sorry I just posted some parts of the code.
Regards, Maka |
outputTime() probably only get
outputTime() probably only gets set if you use the
runTime++ method of incrementing time. This is the way all simulation codes work. Looping over all times like the postprocessing tools do will not (and should not) take notice of the 'writeInterval' setting in the controlDict. So outputTime never gets set. Look at one of the simple postprocessing tools (e.g. magU) on how to forcibly write a field. |
Thanks Mattijs for your help.
Thanks Mattijs for your help.
best regards, Maka |
in the following part of the c
in the following part of the code, Umean.write() only works if it is writen in POSTITION 1 but not 2. The later is the required. It seems that runTime.setTime has some effect.
int main(int argc, char *argv[]) { # include ... # include "createTimeAverages.H" // For each time step read all fields forAll(runTime.times(), i) { Umean.write(); // POSITION 1 runTime.setTime(runTime.times()[i], i); Umean.write(); // POSITION 2 ... } Info<< "end" << endl; return 0; } Umean is defined as : const fileName& local = runTime.timeName(); volVector Field* UmeanPtr = new volVectorField ( IOobject ( "Umean", local, mesh, IOobject::MUST_READ, wo ), mesh ); volVectorField& Umean = *UmeanPtr; I would apreciate any help. Thanks. best Regards, Maka |
Umean.write() does not work in
Umean.write() does not work in POSITION 2 but works outside the loop before main returns. I can live with that. Now, I tried to control the place where Umean.write() writes files by changing:
const fileName& local = "statistics"; but it does not write in statistcs folder, which is a folder that I made to collect all statistics. This makes backup easier since instanous data (big size) and statistics (small size) are separated. any suggestions? Thanks, Maka |
forcing a read operation
Wo
forcing a read operation
Would you please, point to the documentation of write() member function for a volVectorField? is there a read(). I looked into Doxygen docs: I found: GeometricField<vector,> volVectorField Then I looked into all the involved classes, I could not find a write() memeber functions. Thanks, Maka |
runTime.end() does not work if
runTime.end() does not work if you are postprocessing an existing data even if you use runTime.setTime,
This is part of the code: forAll(runTime.times(), i) { runTime.setTime(runTime.times()[i], i); //mesh.readUpdate(); U = volVectorField ( IOobject ( "U", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE ), U ); # include "calculateTimeAverages.H" // Average fields over channel down to a line # include "spaceAverageFields.H" if (runTime.end()) { # include "writeTimeAverages.H" } } My question is does any one understand why member functions of Time class works only when the solver is running? What should we do to let them work when we are processing a data? Thanks. Thanks, Maka. |
You could just read the end ti
You could just read the end time from controlDict and explicitly test for it.
In Time.C line 341 bool Foam::Time::end() const { return (value() > (endTime_ + 0.5*deltaT_)); } So you see your current time has to be at least 0.5 * deltaT larger than endTime to return true. |
I expected the following code
I expected the following code to print: volScalarField T but it prints IOobject T; Is there a way to read the class name that is written in the header file of an IOobject other than headerClassName() (I refer to version 1.3). Thanks.
IOobject Xheader ( "T", runTime.timeName(), mesh, IOobject::MUST_READ ); Info<< "Reading " << Xheader.headerClassName() << " " << varname << endl; |
The header is not read automat
The header is not read automatically. The solution is to add the following before using header.headerClassName().
// read header Xheader.headerOk(); |
Good morning,
I'm writting
Good morning,
I'm writting a basic code to produce the necessary files in order to use the timeVaryingMappedFixedValue patch. However, I'm not able to write my object in the specified path. IOobject IOUpatch ( "U", runTime.constant()/"boundaryData"/"patchTest", //runTime.constant(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ); vectorIOField Upatch(IOUpatch, sizeMesh); For some reason, when Upatch.write(); is called, the file is written in my initial time step (0). Not sure why - any ideas ? Regards, PO |
Is there a directory called "c
Is there a directory called "constant/boundaryData/patchTest" in your case directory?
Dragos |
yes I have it
Thanks
PO
yes I have it
Thanks PO |
Hm, then I suggest that right
Hm, then I suggest that right below the line IOUpatch.write() (I think there is a typo in your post Upatch.write() instead of IOUpatch.write()) insert a new one: system("touch your_case_dir/constant/boundaryData/patchTest/bubu").
See if the file "bubu" gets created! Dragos |
I'm currently struggling on the same problem.
I don't know how to specify a particular path when writing a field. Basically I want to do the same as podallaire in his thread from 9. December 2008. Has anybody found a solution to this problem? |
Hi,
Unfortunately I did not solve the issue since groovyBC was the perfect candidate for what I wanted to do. Maybe this program can help you : OpenFOAM-1.5.x/tutorials/interDyMFoam/sloshingTank3D6DoF/gen6DoF Regards, PO |
Thanks for your answer. Looks like this file shows me how to write a specific file. But thats what I have already managed to do.
Writing the file with this OFstream command leaves the header, which is essential to the timeVaryingMappedFixedValue boundary condition. Doing this with headers by creating an IOobject I can't choose the right path. Just frustrating! |
All times are GMT -4. The time now is 23:38. |