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/)
-   -   runTimeMOdifiable (http://www.cfd-online.com/Forums/openfoam-programming-development/117941-runtimemodifiable.html)

openfoammaofnepo May 17, 2013 14:06

runTimeMOdifiable
 
Dear All,

I generate an additional file in constant folder, and I wrote some flag parameter in it. However, although I set the option runTimeMOdifiable to true, I cannot make OpenFOAM read in the modified parameters again if I change some parameters in that file. How can I make running Openfoam know that modification during the run time?

wyldckat May 18, 2013 12:04

Greetings openfoammaofnepo,

Can you describe how you are loading the parameters from the new dictionary file?

Best regards,
Bruno

openfoammaofnepo May 18, 2013 12:09

Hello,

In the createFields.H file, there are the following lines:

Info<< "Reading Parameters from Dictionary additionalControls \n" << endl;
IOdictionary additionalControls
(
IOobject
(
"additionalControls",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);

dimensionedScalar OmegaRelax
(
additionalControls.lookup("OmegaRelax")
);


In that file, I wrote it like this:

OmegaRelax OmegaRelax [ 0 0 0 0 0 0 0 ] 0.5;

Using this method, I found that I cannot make it modifiable during the simulation.

Thank you.

Quote:

Originally Posted by wyldckat (Post 428444)
Greetings openfoammaofnepo,

Can you describe how you are loading the parameters from the new dictionary file?

Best regards,
Bruno


wyldckat May 18, 2013 12:48

Hi openfoammaofnepo,

Try switching "MUST_READ" to "MUST_READ_IF_MODIFIED".

For reference, check the solver icoFoam, more specifically the file "createFields.H": https://github.com/OpenFOAM/OpenFOAM...createFields.H

Best regards,
Bruno

openfoammaofnepo July 24, 2013 10:11

Dear Bruno,

When I use MUST_READ_IF_MODIFIED option, when I change that parameter during the run time period, the new value for it is still updated in the simulations. But from the output, the dictionary has already been read again. This is a little strange. Did I forget the change something in the createFields.H?

Thank you very much.

Quote:

Originally Posted by wyldckat (Post 428453)
Hi openfoammaofnepo,

Try switching "MUST_READ" to "MUST_READ_IF_MODIFIED".

For reference, check the solver icoFoam, more specifically the file "createFields.H": https://github.com/OpenFOAM/OpenFOAM...createFields.H

Best regards,
Bruno


wyldckat August 18, 2013 16:56

Hi openfoammaofnepo,

I've been very busy for the past few weeks. I don't know if you have solved this. Either way, I'm not sure I understand what you wrote:
Quote:

Originally Posted by openfoammaofnepo (Post 441710)
when I change that parameter during the run time period, the new value for it is still updated in the simulations. But from the output, the dictionary has already been read again.

Do you mean that although the dictionary is read during the run, the value inside the variable in memory has not changed?

If this is the case, I suggest that you test the "cavity" tutorial case with icoFoam and a very long simulation time; then change the "nu" property in the file "constant/transportProperties" while it's running. Check the results and whether the viscous influence changed the flow profile or not.
  • If it works for icoFoam, then this method should work for you as well.
  • But if it does not work for icoFoam, then it's unlikely that it will work for you.
Best regards,
Bruno


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