CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   update dictionary within runTime loop (https://www.cfd-online.com/Forums/openfoam-solving/204005-update-dictionary-within-runtime-loop.html)

sam7 July 11, 2018 22:37

update dictionary within runTime loop
 
Hello.
Following this and this I'm trying to update a subdictionary of dynamicMeshDict whitin the runTime loop of pimpleDyMFoam.C with
Code:

myDict.set("name",value);
but I'm facing the same problem as the first link above: the code compiles with no errors but the value does not update. I changed the WRITE_OPTIONS of the dictionary to AUTO_WRITE as suggested in first link but the problem persists. Here's what I have:
Code:

const word dictName("dynamicMeshDict");
    const word subDictName("solidBodyMotionFvMeshCoeffs");
    const word subsubDictName("rotatingMotionCoeffs");
    fileName dictPath;
    dictPath =runTime.constant()/dictName;
    IOdictionary dynamicMeshDict
                  (
                    IOobject
                            (
                            dictPath,
                            mesh,
                            IOobject::MUST_READ,
                            IOobject::AUTO_WRITE,
                            false
                            )
                  );

Then, within runTime loop, I have:
Code:

newomega = newomega + domegadt;
        vector omegav = vector(dynamicMeshDict.subDict(subDictName)
                                          .subDict(subsubDictName)
                                                .lookup("axis"))*
                readScalar(dynamicMeshDict.subDict(subDictName)
                                          .subDict(subsubDictName)
                                          .lookup("omega"));
        dynamicMeshDict.subDict(subDictName).subDict(subsubDictName).set("omega",newomega);

I'm using OpenFOAM-v1606+
Any help in figuring out why "omega" is not being updated in dynamicMeshDict with really be appreciated.
Thanks for reading.

pvpnrao September 8, 2018 22:35

Sam



were you able to figureout this issue.


I need to implement the same functionality


All times are GMT -4. The time now is 21:03.