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

Creating a control from fvSolution before the mesh creation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2018, 19:28
Default Creating a control from fvSolution before the mesh creation
  #1
Member
 
Martin
Join Date: Dec 2011
Posts: 40
Rep Power: 14
msaravia is on a distinguished road
Hi ! I know this question may result trivial, but I could not manage to do it.

I need to read the fvSolution dictionary without using a reference to the mesh. This is why:

I was creating the control as:

Code:
const dictionary& vmfControl = mesh.solutionDict().subDict("VMF");
but now I have a multi region mesh; and although I could add a fvSolution file to every region folder and create a control for every region as

Code:
const dictionary& vmfControl = mesh[i].solutionDict().subDict("VMF");
I want to use only one fvSolution file for all the regions.

EDIT: I have created a dictionary using Time as a register


Code:
IOdictionary vmfControl
(
    IOobject
    (
        "vmf",
        runTime.system(),
        runTime,
        IOobject::MUST_READ_IF_MODIFIED,
        IOobject::NO_WRITE
    )
);

Thanks in advance.
msaravia is offline   Reply With Quote

Old   October 8, 2018, 10:53
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,
the mesh is not required, but you need other objects (that are stored inside the mesh object). To get an idea, you have to look into the Doxygen source code guide (https://cpp.openfoam.org/v6/classFoam_1_1IOobject.html).

Here you see the different constructors for the IOobject object. So basically, the mesh will deliver the const objectRegistry &registry object.

So what you can do is, first build an objectRegistry object and use it for constructing your IOdictionary; cf. https://cpp.openfoam.org/v6/classFoa...tRegistry.html
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 8, 2018, 11:59
Default
  #3
Member
 
Martin
Join Date: Dec 2011
Posts: 40
Rep Power: 14
msaravia is on a distinguished road
Hi Tobi, thanks for your answer. I have used runTime, which is a registry object. Its being a hard work to dig all OF source code...
msaravia is offline   Reply With Quote

Reply


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
[snappyHexMesh] Creating very fine, high accuracy mesh with snappyHexMesh JD_Welch OpenFOAM Meshing & Mesh Conversion 10 July 5, 2023 12:50
[blockMesh] Segmentation Fault when creating block mesh topography (blockMesh) jbrydg01 OpenFOAM Meshing & Mesh Conversion 2 May 11, 2017 06:37
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 10:38
[ICEM] Problem making structured mesh on a surface froztbear ANSYS Meshing & Geometry 4 November 10, 2011 09:52


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