|
[Sponsors] |
November 17, 2016, 04:32 |
update object in objectRegistry
|
#1 |
New Member
Khomenko Maxim
Join Date: Aug 2015
Posts: 18
Rep Power: 11 |
Hello!
I run my solver which uses field.oldTime().oldTime().oldTime() function. When I start from initial time the field_0_0_0 updates in objectRegistry and every thing is ok. But then I continue calculation from some time the field_0_0_0 in object registry is not equal to field_0_0_0 its self. In objectRegistry it is equal to initial value read from time directory. So the question is how to update a field_0_0_0 in its objectRegistry manually? Code:
// create or read T // mesh is objectRegistry for T while (runTime.run()) { // update T // use T.oldTime().oldTime().oldTime() Info<<T.oldTime().oldTime().oldTime()<<endl; // and Info<<mesh.lookupObject<volScalarField>("T_0_0_0")<<endl; runtime.write() } Last edited by mbookin; November 17, 2016 at 04:35. Reason: clarity |
|
November 19, 2016, 08:43 |
Default update object in objectRegistry
|
#2 |
Member
Jean-Michel FONTAINE
Join Date: Aug 2009
Location: Orleans - France
Posts: 55
Rep Power: 17 |
Hi
You might want to read my answer #2 to a similar problem here: http://www.cfd-online.com/Forums/ope...dymfoam-c.html based on the answer #14 in : http://www.cfd-online.com/Forums/ope...rfield-bc.html Regards Jean-Michel |
|
November 28, 2016, 10:00 |
update geometricField in registry
|
#3 |
New Member
Khomenko Maxim
Join Date: Aug 2015
Posts: 18
Rep Power: 11 |
Thank you for your answer!
The post you gave, as I understood, is about how to write something that is not in registry. You use function set() to update you dictionaries. My field_0_0_0 is in the registry, but is not updated. The problem is that geometricField class has no such function like set() so I cant update it manually or may be I miss something. Did I understand you right? Last edited by mbookin; November 28, 2016 at 10:27. Reason: clarity, typo |
|
November 28, 2016, 18:59 |
Update geometricField in registry
|
#4 |
Member
Jean-Michel FONTAINE
Join Date: Aug 2009
Location: Orleans - France
Posts: 55
Rep Power: 17 |
Dear Maxim
You don't give much details... Instead of "runtime.write()" would "T.write()" work ? Jean-Michel |
|
November 29, 2016, 06:58 |
|
#5 |
New Member
Khomenko Maxim
Join Date: Aug 2015
Posts: 18
Rep Power: 11 |
I made simple testSolver and testCase for someone who wants to help me to handle this problem. PseudoCode as follows, and the code is attached below.
Code:
volScalarField T ( IOobject ( "T", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); while (runTime.run()) { runTime++; T=runTime.timeIndex(); Pout<<tab<<"T="<<T[0]<<endl; Pout<<tab<<"T.()="<<T.oldTime()[0]<<tab<<" writeOpt= "<<T.oldTime().writeOpt()<<endl; Pout<<tab<<"T.()()="<<T.oldTime().oldTime()[0]<<tab<<" writeOpt= "<<T.oldTime().oldTime().writeOpt()<<endl; Pout<<tab<<"T.()()()="<<T.oldTime().oldTime().oldTime()[0]<<tab<<" writeOpt= "<<T.oldTime().oldTime().oldTime().writeOpt()<<endl; Pout<<tab<<"T.reg_0_0_0="<<T.db().lookupObject<volScalarField>("T_0_0_0")[0]<<endl; runTime.write(); } Code:
Reading field T T.().().writeopt= 1 T.().().().writeopt= 1 T=0 T.()=0 T.()()=0 T.()()()=0 Time = 1 T=1 T.()=0 writeOpt= 0 T.()()=0 writeOpt= 1 T.()()()=0 writeOpt= 1 T.reg_0_0_0=0 Time = 2 T=2 T.()=1 writeOpt= 0 T.()()=0 writeOpt= 0 T.()()()=0 writeOpt= 1 T.reg_0_0_0=0 Time = 3 T=3 T.()=2 writeOpt= 0 T.()()=1 writeOpt= 0 T.()()()=0 writeOpt= 1 T.reg_0_0_0=0 Time = 4 T=4 T.()=3 writeOpt= 0 T.()()=2 writeOpt= 0 T.()()()=1 writeOpt= 1 T.reg_0_0_0=1 Time = 5 T=5 T.()=4 writeOpt= 0 T.()()=3 writeOpt= 0 T.()()()=2 writeOpt= 1 T.reg_0_0_0=2 End I even can write need field by T.db().lookupObject<volScalarField>("T_0_0_0").wri te(); But when I continue it is still not updated in objectRegistry, so the second continue is impossible. Attachment 52119 Last edited by mbookin; November 29, 2016 at 16:49. Reason: adding information |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
error in fireFoam, when running the case wallFireSpread2D | zhoubiao1088 | OpenFOAM Running, Solving & CFD | 9 | February 1, 2018 19:45 |
[foam-extend.org] Error compiling OpenFOAM-1.6-ext | Canesin | OpenFOAM Installation | 137 | January 20, 2016 15:56 |
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 | keepfit | ParaView | 60 | September 18, 2013 04:23 |
Compilation error OF1.5-dev on Suse10.3 | darenyang | OpenFOAM Installation | 0 | April 29, 2009 05:55 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |