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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 29, 2021, 11:28
Default Creating file dict during a routine
  #1
New Member
 
Join Date: Sep 2020
Posts: 6
Rep Power: 5
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 03: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 18:13
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23


All times are GMT -4. The time now is 00:28.