CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Creating file dict during a routine

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 29, 2021, 12:28
Default Creating file dict during a routine
  #1
New Member
 
Join Date: Sep 2020
Posts: 6
Rep Power: 6
furystep is on a distinguished road
Hi All!
I have searched for this problem but none asked before me.
I am trying to build and write a new dictionary inside my OF solver to pass some values to another solver. In simple words, I want to create something like "transportProperties" but it must be written by my solver. I defined the IOdictionary in my code and set a subdict and some keys with their values:

Code:
 
IOdictionary newProperties(
IOobject("newProperties",
runTime.constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE));

dictionary& subdict = newProperties.subDict(subname);
subdict.set("key1",value1);
subdict.set("key2", value2);
newProperties.regIOobject::write();
I am trying to write this newProperties dictionary but even if compile, it crashes because it searches for the dictionary inside the folders (the error is something like "can't find the entry subname"). How can I write a dictionary and solve this problem? Thanks in advance.
furystep is offline   Reply With Quote

Reply

Tags
dictionary, iodictionary, ioobject, ioobject write, runtime


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 19:13
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23


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