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

IOerror when using function objects in debug-mode

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   July 6, 2022, 13:04
Default IOerror when using function objects in debug-mode
  #1
New Member
 
Join Date: Dec 2021
Posts: 27
Rep Power: 4
finn_amann is on a distinguished road
Hello friends,

facts:
  • OpenFoam 9 (foundation version) debug-mode
  • Compiled with GCC/G++ 9.4.0 (also tried gcc-11)
  • OS: Pop!_OS 22.04

whenever I try to use function objects in my simulation I get error message below:

Code:
...
Courant Number mean: 0 max: 0

Starting time loop



--> FOAM FATAL IO ERROR: 
error in IOstream "OSHA1stream.sinkFile_" for operation Ostream& operator<<(Ostream&, const char)

file: OSHA1stream.sinkFile_ at line 0.

    From function virtual bool Foam::IOstream::check(const char*) const
    in file db/IOstreams/IOstreams/IOstream.C at line 96.

FOAM exiting
I added the sub-dictionary into my controlDict as follows:

Code:
functions 
{
  myFunction
  {
    // I can write whatever I want in here, the error will occur anyway. 
    type whateverFunction;
    functionObjectsLibs (...);
    ...
  }
};
I also tried this on my work machine (Ubuntu 20.04, also gcc-9) on which it works fine.

The error occurs when OF tries to read the sub-dictionary for functions. I did some debugging and found out that the error originates (if I can say so) in the read() function of functionObjectList.C, line 799 when dict.digest() is called. I marked the exact spot in the following code. Of course it goes down deeper into the code, but I can't really follow what's happening in there since I have no idea what SHA1 digests are:

Code:
bool Foam::functionObjectList::read()
{
    bool ok = true;
    updated_ = execution_;

    // Avoid reading/initialising if execution is off
    if (!execution_)
    {
        return true;
    }

    // Update existing and add new functionObjects
    const entry* entryPtr = parentDict_.lookupEntryPtr
    (
        "functions",
        false,
        false
    );

    if (entryPtr)
    {
        PtrList<functionObject> newPtrs;
        List<SHA1Digest> newDigs;
        HashTable<label> newIndices;

        label nFunc = 0;

        if (!entryPtr->isDict())
        {
            FatalIOErrorInFunction(parentDict_)
                << "'functions' entry is not a dictionary"
                << exit(FatalIOError);
        }

        const dictionary& functionsDict = entryPtr->dict();

        libs.open
        (
            functionsDict,
            "libs",
            functionObject::dictionaryConstructorTablePtr_
        );

        newPtrs.setSize(functionsDict.size());
        newDigs.setSize(functionsDict.size());

        forAllConstIter(dictionary, functionsDict, iter)
        {
            const word& key = iter().keyword();

            if (!iter().isDict())
            {
                if (key != "libs")
                {
                    IOWarningInFunction(parentDict_)
                        << "Entry " << key << " is not a dictionary" << endl;
                }

                continue;
            }

            const dictionary& dict = iter().dict();
            bool enabled = dict.lookupOrDefault("enabled", true);

            newDigs[nFunc] = dict.digest(); // in here something goes wrong.
...
Did this ever happen to any of you? It's probably difficult to reproduce, as the exact same simulation works on my other machine...

I already opened an issue on Github (https://github.com/OpenFOAM/OpenFOAM-9/issues/12), however, I think this community is probably more active.

Any help is appreciated!

Best regards
Finn

Last edited by finn_amann; July 7, 2022 at 02:33. Reason: clarification
finn_amann is offline   Reply With Quote

 


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
Calculating source term total cell-zone volume parallel computation RobV Fluent UDF and Scheme Programming 2 May 30, 2022 03:46
Foam-extend crashes with custom BC, but works fine in Debug mode Arman_N OpenFOAM Programming & Development 7 September 26, 2020 01:51
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 14:07
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
Droplet Evaporation Christian Main CFD Forum 2 February 27, 2007 06:27


All times are GMT -4. The time now is 19:39.