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

[Salome] Beginner Question: Error using IdeasUnvtoFoam.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 24, 2019, 19:35
Default Beginner Question: Error using IdeasUnvtoFoam.
  #1
Senior Member
 
nm
Join Date: Mar 2013
Posts: 100
Rep Power: 13
nvarma is on a distinguished road
Hi,
I am getting the following strange error when I use the unv to foam tool. Can anyone please help me figure out what's causing this?


--> FOAM FATAL ERROR:
cannot find file "/home/xxxx/OpenFOAM/xxxx-6/run/run1/mesh/system/controlDict"

From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::rea dStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 519.

FOAM exiting


Why do I need a controlDict file since I have already created the mesh on Salome?


Edit: it does work with a controlDict file. I am just curious how/why it is used and if I can tweak anything in there.
nvarma is offline   Reply With Quote

Old   February 25, 2019, 21:48
Default Reason
  #2
Senior Member
 
nm
Join Date: Mar 2013
Posts: 100
Rep Power: 13
nvarma is on a distinguished road
If it helps anyone in the future, it was because of pyramid meshes in Salome. I know, rookie mistake. Was resolved easily by splitting pyramids into tetra. Also solved by using the right schemes before meshing.
nvarma is offline   Reply With Quote

Old   April 4, 2019, 13:24
Default
  #3
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 339
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
Quote:
Originally Posted by nvarma View Post
Hi,

Why do I need a controlDict file since I have already created the mesh on Salome?


Edit: it does work with a controlDict file. I am just curious how/why it is used and if I can tweak anything in there.
Why do you need a controlDict?


The controlDict file contains some basic controls, which are relevant to a lot of tools and solvers of OpenFOAM, e.g. writeFormat: write data in ASCII or binary.

The ideasUnvToFoam converter needs a controlDict to be present, because this tool uses a Time object. The instructions to create a Time object are in the file createTime.H. Let's take a look:

Code:
Foam::Info<< "Create time\n" << Foam::endl;

Foam::Time runTime(Foam::Time::controlDictName, args);
We see, or surmise, the constructor takes the name of the controlDict as an argument. This suggests, that controlDict is involved in the construction of the Time object. Let's take a look at the constuctor of the Time class:

Code:
// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::Time::Time
(
    const word& controlDictName,
    const fileName& rootPath,
    const fileName& caseName,
    const word& systemName,
    const word& constantName,
    const bool enableFunctionObjects
)
:
    // stuff removed for brevity

    controlDict_
    (
        IOobject
        (
            controlDictName,
            system(),
            *this,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE,
            false
        )
    ),
    
    // stuff removed for brevity
In this snippet of the file Time.C, we see that the file controlDict is read by the constructor. Hence, if the controlDict is absent, construction of the Time object fails with an error message.


So why is the Time object important for a mesh converter?

The basic function of a mesh converter requires it to create a valid OpenFOAM-style mesh, either for reading (the foamTo* converters) or for writing (the *ToFoam converters).

The mesh is created by instructions from the createMesh.H file. It reads:

Code:
Foam::Info
    << "Create mesh for time = "
    << runTime.timeName() << Foam::nl << Foam::endl;

Foam::fvMesh mesh
(
    Foam::IOobject
    (
        Foam::fvMesh::defaultRegion,
        runTime.timeName(),
        runTime,
        Foam::IOobject::MUST_READ
    )
);
Here, we see that the runTime object is passed to the constructor of the mesh class.
Hence the need to create a Time object.

In fact, ideasUnvToFoam does not use the createMesh.H file. There are other instructions for creating the mesh, yet the runTime object is still required for the constructor. Here is some actual code of ideasUnvToFoam:

Code:
    // Construct mesh
    polyMesh mesh
    (
        IOobject
        (
            polyMesh::defaultRegion,
            runTime.constant(),
            runTime
        ),
        xferMove(polyPoints),
        cellVerts,
        usedPatchFaceVerts,             // boundaryFaces,
        usedPatchNames,                 // boundaryPatchNames,
        wordList(patchNames.size(), polyPatch::typeName), // boundaryPatchTypes,
        "defaultFaces",             // defaultFacesName
        polyPatch::typeName,        // defaultFacesType,
        wordList(0)                 // boundaryPatchPhysicalTypes
    );
Thus, even a mesh converter, which deals only with meshes, needs a controlDict in order to create a Time object.
Also some of the classes which make up the type polyMesh might read some data from controlDict.
GerhardHolzinger 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
question about uds tanven FLUENT 2 July 5, 2015 11:22
Beginner Question me.ouda FLOW-3D 2 May 3, 2010 17:47
Question about Table applicaiton. universez OpenFOAM Running, Solving & CFD 0 January 12, 2010 20:31
Beginner question :(. Turning on and off zones? Cjlaumans FLUENT 6 September 2, 2009 15:44
CHANNEL FLOW: a question and a request Carlos Main CFD Forum 4 August 23, 2002 05:55


All times are GMT -4. The time now is 07:33.