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

"Missing" files when implementing OpenFOAM dictionaries referenced in custom solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2018, 16:58
Default "Missing" files when implementing OpenFOAM dictionaries referenced in custom solver
  #1
New Member
 
Mark De Luca
Join Date: Oct 2018
Posts: 1
Rep Power: 0
markdeluca is on a distinguished road
Hi everyone,

I’ve inherited some code as part of my PhD project. The code is written in c++ and includes various OpenFOAM files to define the gas models that are implemented within it.

Required to build the code is OpenFOAM 2.1.1, which is installed in my $HOME/OpenFOAM directory. The CMakeLists.txt for generating the Makefile details lines that include some key libraries required.
Code:
 

if($ENV{WM_PROJECT_VERSION} STREQUAL "2.1.1") 

include_directories($ENV{FOAM_SRC}/OpenFOAM/lnInclude 
$ENV{FOAM_SRC}/finiteVolume/lnInclude 
$ENV{FOAM_SRC}/thermophysicalModels/reactionThermo/lnInclude 
$ENV{FOAM_SRC}/OSspecific/POSIX/lnInclude 
$ENV{FOAM_SRC}/thermophysicalModels/specie/lnInclude)
This seems to execute fine, as the project can build without error. I run the ‘of211’ alias command to set the shell environment, defined as such in the ~/.bashrc file.

Code:
 
alias of211='source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc WM_NCOMPPROCS=6 WM_MPLIB=SYSTEMOPENMPI WM_COMPILER=Gcc48'
I then attempt to execute the code, which generates this error:

Code:
 
--> FOAM FATAL ERROR in Foam::findEtcFiles() : could not find mandatory file 
    'cellModels' 

free(): invalid pointer 
Aborted (core dumped)
Searching for the definition of Foam::findEtcFiles() gives this (located at $WM_PROJECT_DIR/src/Osspecific/POSIX/POSIX.C )

Code:
 
Foam::fileNameList Foam::findEtcFiles 
( 
    const fileName& name, 
    bool mandatory, 
    bool findFirst 
) 
{ 
 searchDir = getEnv("WM_PROJECT_DIR"); 
    if (isDir(searchDir)) 
    { 
        fileName fullName = searchDir/"etc"/name; 
        if (isFile(fullName)) 
        { 

            results.append(fullName); 
            if (findFirst) 
            { 

                return results; 

            } 
        } 
    } 
}
From my understanding, the code above should search $WM_PROJECT_DIR/etc for the ‘file’ , in this case “cellModels’, and detect it. The environment seems to be set fine and the file exists as far as I can tell, as shown below.

Code:
 
mark@hp-mark732:~$ env | grep 'WM_PROJECT_DIR' 
WM_PROJECT_DIR=/home/mark/OpenFOAM/OpenFOAM-2.1.1 

mark@hp-mark732:~$ ls $WM_PROJECT_DIR/etc 
bashrc  cellModels  codeTemplates  config  controlDict  cshrc  thermoData
I guess I haven't technically asked a question yet, so my question is this:
Has the environment been set correctly to detect this file, or is there something else needed to be done?
Any help would be much appreciated. I have used OpenFOAM a few years back as part of my undergrad, but it’s not really my main area of focus, so I feel I’m a bit out of my depth.


As some additional information, the executable programs aren’t ran using any of the OpenFOAM solvers (such as ‘icoFoam’ etc), they are built with the ‘make’ command that compiles all the source code, and are ran from the terminal window (./someFile) , or can be executed through an IDE (I’m using the terminal currently to help with debugging). On a basic level, the code simulates various aero engine configurations to give performance data, with the OpenFOAM dictionaries being used to model the gas properties of the working fluid as it passes through stages of the engine. The operating system being used is Ubuntu 18.04.


Again, many thanks for reading what’s quite a lengthy post. If I haven’t been clear on anything, let me know and I’ll try clear it up.


Thanks,
Mark.

Last edited by markdeluca; December 3, 2018 at 06:53.
markdeluca 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
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 14:24
Trying to compile custom solver "turbineALSource" in OpenFOAM 2.2 mohsen.boojari OpenFOAM Programming & Development 1 April 16, 2016 16:35
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 09:04
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 03:01
OpenFOAM Training in Europe and USA hjasak OpenFOAM 0 August 8, 2008 05:33


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