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/)
-   -   Error at runtime modification of a volScalField (http://www.cfd-online.com/Forums/openfoam-programming-development/122021-error-runtime-modification-volscalfield.html)

Scofield August 10, 2013 08:34

Error at runtime modification of a volScalField
 
Hi Foamers,

this is my first thread. I try to modify a volScalarField called "modifyS" during runtime of a simulation. "modifyS" is a uniform field and located in the "constant" directory of my case.

I specify this field by using following IOobject definition:
----------------------
volScalarField modifyS
(
IOobject
(
"modifyS",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
),
mesh
);
----------------------

I have tried two variations:
1) I have defined this IOobject in "creativeFields.H".
2) I have tried to define this IOobject at the beginning of the time loop of my solver.

Just in case 2) the modification is read in. But I could recognize following:
In both cases, if If i change the uniform field "modifyS" during runtime, mostly the simulation goes on, but sometimes the simulation is aborted with following error:
---------------------
--> FOAM FATAL IO ERROR:
cannot open file

file: /home/BAUINFORMATIK/scheffold/OpenFOAM/scheffold-2.2.0/run/interactivity/PflegerTestModifyS/constant/modifyS at line 0.

From function regIOobject::readStream()
in file db/regIOobject/regIOobjectRead.C at line 87.

FOAM exiting
-----------------------

I have compared it with a IOdictionary using "MUST_READ_IF_MODIFIED". There, the simulation never stops after making modifications in the case.

I would really appreciate if anybody knows, why the simulation sometimes is terminated when i modify a volScalField?

Best regards,
Daniel

mkraposhin August 14, 2013 14:02

"
2) I have tried to define this IOobject at the beginning of the time loop of my solver.
"

when you create your field at the new time step, you are creating the new object, so it will be initialized anyway.

IOobject and regIOobject classes for this problem are under discussion here


All times are GMT -4. The time now is 14:30.