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

FOAM FATAL ERROR in Foam::findEtcFile() : could not find mandatory file

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By wyldckat
  • 1 Post By wyldckat
  • 1 Post By t.oliveira

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 27, 2009, 09:43
Default FOAM FATAL ERROR in Foam::findEtcFile() : could not find mandatory file
  #1
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 250
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Hi all!

I have following problem while running OpenFOAM 1.6 on cluster with queuing system. I compiled OpenFOAM from scratch using GCC from OF distribution and MVAPICH installed on cluster. OpenFOAM runs perfect on login machine in serial, but when I start it with queuing system it fails with such error in error output:

--> FOAM FATAL ERROR in Foam::findEtcFile() : could not find mandatory file
'controlDict'

As I understand, OpenFOAM could not get proper environment variable while running on remote machine. How to provide proper environment for OpenFOAM?

Thank you in advance
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   October 27, 2009, 12:03
Default
  #2
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 250
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Problem solved!
Tommorow read about my expereance with OpenFOAM on MVAPICH+InfinityBand
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   September 3, 2011, 04:48
Default
  #3
New Member
 
mrv4real
Join Date: Sep 2011
Posts: 11
Rep Power: 14
mrv4real is on a distinguished road
Hi,

even if this is an very old thread, do you remember the solution? Do i have to set some environment variables and if yes, which are they? setting the -case unfortunately did not work.

Thanks in advance,
mrv4real
mrv4real is offline   Reply With Quote

Old   September 3, 2011, 07:39
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings mrv4real and welcome to the forum!

There are at least two ways for doing this:
  1. There is a script named "foamExec" that you can use to launch OpenFOAM applications. Run in your current terminal/console window the following command:
    Code:
    which foamExec
    Now, use that script for calling your desired solver or application. As an example, for running icoFoam in parallel in my machine, instead of simply using:
    Code:
    icoFoam -parallel
    I would use:
    Code:
    /home/me/OpenFOAM/OpenFOAM-2.0.x/bin/foamExec icoFoam -parallel
    This should work on all OpenFOAM versions, but sadly it doesn't always work, due to some bugs that existed on some versions.
  2. Or you can use a job file for the PBS, like the one shown here: http://www.cfd-online.com/Forums/ope...tml#post286124 - post #5
Best regards,
Bruno
rasool_soofi likes this.
__________________
wyldckat is offline   Reply With Quote

Old   September 3, 2011, 08:19
Default
  #5
New Member
 
mrv4real
Join Date: Sep 2011
Posts: 11
Rep Power: 14
mrv4real is on a distinguished road
Hi Bruno,

thanks a lot for the nice welcome message and your fast reply!

I tried your suggestions but am still having problems. I try to run it on a BlueGene/P and it works for serial code.

If I try it with mpirun in a loadleveler script, i had to pass the LD_LIBRARY_PATH environment variable and allthough that i specify the case directory with "-case <...>" he throws the error message about the missing controlDict.

Is there a way to give the directory of the simulation using an environment variable i can pass to the mpirun?

Thanks,
mrv4real
mrv4real is offline   Reply With Quote

Old   September 3, 2011, 08:33
Default
  #6
New Member
 
mrv4real
Join Date: Sep 2011
Posts: 11
Rep Power: 14
mrv4real is on a distinguished road
... maybe it is best, if I post the script for the loadleveler. Hoping for some sugesstions...

#!/bin/sh
# @ account_no = []
# @ job_name = test_damBreak
# @ output = $(job_name).out
# @ error = $(job_name).err
# @ environment = COPY_ALL
# @ wall_clock_limit = 00:05:00
# @ notification = always
# @ notify_user = my@address.net

# @ job_type = bluegene
# @ bg_size = 4


# @ queue

source ~/OpenFOAM/OpenFOAM-1.6/etc/bashrc

cd /home/my_account/damBreak

mpirun -np 4 -mode SMP -cwd /home/my_account/damBreak -exe /home/my_account/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/interFoam -args "-case /home/my_account/damBreak -parallel" -env LD_LIBRARY_PATH=/home/my_account/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/mpi:/home/my_account/OpenFOAM/my_account-1.6/lib/linuxGccDPOpt:/home/my_account/OpenFOAM/site/1.6/lib/linuxGccDPOpt:/home/my_account/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt


Thanks a lot,
mrv4real
mrv4real is offline   Reply With Quote

Old   September 3, 2011, 09:43
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi mrv4real,

I forgot to mention that the controlDict that the solver is complaining about is not the one in your case's system folder; it is complaining about not finding "OpenFOAM-1.6/etc/controlDict". This means that LD_LIBRARY_PATH is far from enough; there are a whole lot more variables that would need exporting.

Mmm... OpenFOAM 1.6 is getting old now... but OK, let's try this:
  1. foamExec in 1.6 allows you to read OF's bashrc file from a personal folder, namely "$HOME/.OpenFOAM/$version/bashrc". So, the following commands will create the personal folder used by OpenFOAM and copy the bashrc file to the newly created folder:
    Code:
    mkdir -p $HOME/.OpenFOAM/1.6
    cp $WM_PROJECT_DIR/etc/bashrc $HOME/.OpenFOAM/1.6/
  2. Edit the copied file if necessary, such as hard coding some of the folders to use your "/home/my_account", instead of $HOME.
  3. Now, as for the loadleveler script, this should do the trick:
    Code:
    #!/bin/sh
    # @ account_no = []
    # @ job_name = test_damBreak
    # @ output = $(job_name).out
    # @ error = $(job_name).err
    # @ environment = COPY_ALL
    # @ wall_clock_limit = 00:05:00
    # @ notification        = always
    # @ notify_user        = my@address.net
    
    # @ job_type = bluegene
    # @ bg_size = 4
    
    
    # @ queue
    
    source $HOME/.OpenFOAM/1.6/bashrc
    
    cd /home/my_account/damBreak
    
    mpirun -np 4 -mode SMP -cwd $PWD -exe `which foamExec`  -args "interFoam -parallel"
    It's simpler this way and more easily adaptable when you need to change something. Otherwise there is another way, but it ain't pretty
Good luck!
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   September 3, 2011, 10:05
Default
  #8
New Member
 
mrv4real
Join Date: Sep 2011
Posts: 11
Rep Power: 14
mrv4real is on a distinguished road
Hi,

i already tried it with a script, but then mpirun gives the error "Load failed on 172.16.100.69: Magic value in ELF header of executable file is invalid"

This comes from the fact, that foamExec is a script and not an executable. I found something about a "-m script" switch for mpirun, but the BlueGene doesn´t accept it...

Thanks,
mrv4real
mrv4real is offline   Reply With Quote

Old   September 3, 2011, 11:27
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
I did a bit of googling and found this: http://bluegene.epfl.ch/mpirun.txt
There seems to be an option named "-env_all". This would simplify the script, therefore not needing foamExec nor to manually define each variable to be sent.

If that doesn't work, then it's not going to be pretty

If I'm not mistaken, the necessary variables are: PATH LD_LIBRARY_PATH WM_PROJECT_DIR WM_PROJECT_INST_DIR WM_OPTIONS FOAM_LIBBIN FOAM_APPBIN FOAM_USER_APPBIN MPI_BUFFER_SIZE
The last one depends on the MPI you are using in BlueGene. In bold are the ones that are reeeeally necessary. I think the other ones are sometimes necessary...

Something like this should work:
Code:
#!/bin/sh
# @ account_no = []
# @ job_name = test_damBreak
# @ output = $(job_name).out
# @ error = $(job_name).err
# @ environment = COPY_ALL
# @ wall_clock_limit = 00:05:00
# @ notification        = always
# @ notify_user        = my@address.net

# @ job_type = bluegene
# @ bg_size = 4


# @ queue

source ~/OpenFOAM/OpenFOAM-1.6/etc/bashrc

cd /home/my_account/damBreak

mpirun -np 4 -mode SMP -cwd $PWD -exe `which interFoam`  -args "-parallel" -exp_env LD_LIBRARY_PATH -exp_env PATH -exp_env WM_PROJECT_DIR -exp_env WM_PROJECT_INST_DIR -exp_env  WM_OPTIONS -exp_env  FOAM_LIBBIN -exp_env  FOAM_APPBIN -exp_env  FOAM_USER_APPBIN -exp_env MPI_BUFFER_SIZE
If exporting the current variables to the remote nodes can't be done, then... well, the only ones that can have problems are PATH and LD_LIBRARY_PATH, so for the remaining variables, you can use the "-exp_env" option.

Oh, about PWD: this is usually an environment variable that has the path for the current directory, but it might not work on the environment you are working on

Best regards,
Bruno
wht likes this.
__________________
wyldckat is offline   Reply With Quote

Old   September 3, 2011, 14:34
Default
  #10
New Member
 
mrv4real
Join Date: Sep 2011
Posts: 11
Rep Power: 14
mrv4real is on a distinguished road
thanks a lot !!! now it works.

Best,
mrv4real
mrv4real is offline   Reply With Quote

Old   December 2, 2011, 09:29
Default
  #11
Senior Member
 
Join Date: Mar 2011
Posts: 158
Rep Power: 15
tH3f0rC3 is on a distinguished road
Edit: sorry for posting.
tH3f0rC3 is offline   Reply With Quote

Old   April 4, 2014, 21:34
Default problem in running openfoam in parallel
  #12
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Hello Foamers,

I was able to compile my test code (PNPFoam) and could run it in a serial mode in Kraken cluster. However, when I was trying to run a parallel case, I had an error similar to the ones discussed in the above message.

Code:
FOAM FATAL ERROR in Foam::findEtcFiles() : could not find mandatory file
    'controlDict--> FOAM FATAL ERROR in Foam::findEtcFiles() : could not find mandatory file
I tried to follow the above procedure, but none of them worked.

Below is my sample script file to run the parallel case.
Code:
#!/bin/bash
#PBS -A TG-CDA100010
#PBS -l size=72,walltime=00:02:00
#PBS -o a.out
#PBS -N  simout 

cd $PBS_O_WORKDIR

aprun -n 72 -N 12 /lustre/scratch/joonho/openfoamv/conc_10mM/2D_simulations/PNP_solve/PNP_Foam
also below are the export environments that are defined in the bashrc file in my home folder

Code:
export LD_LIBRARY_PATH=/lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/system-dynlib:/lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/mpich2-system:/lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib/dummy:/opt/gcc/mpc/0.8.1/lib:/opt/gcc/mpfr/2.4.2/lib:/opt/gcc/gmp/4.3.2/lib:/opt/gcc/4.6.2/snos/lib64:/lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/lib:/opt/cray/atp/1.4.1/lib

export PATH=/lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/OpenFOAM-2.1.1/wmake:/lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin:/lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/OpenFOAM-2.1.1/bin:/opt/cray/atp/1.4.1/bin:/opt/cray/xt-asyncpe/5.11/bin:/opt/cray/pmi/2.1.4-1.0000.8596.15.1.ss/bin:/opt/gcc/4.6.2/bin:/nics/e/sw/xt-cle3.1/xdusage:/sw/xt/globus/5.0.4/binary/bin:/sw/xt/globus/5.0.4/binary/sbin:/sw/altd/bin:/usr/local/hsi/bin:/usr/local/gold/bin:/sw/xt/bin:/opt/moab/6.1.6/bin:/opt/torque/2.5.11/bin:/opt/cray/lustre-cray_ss_s/1.8.4_2.6.27.48_0.12.1_1.0301.5943.18.1-1.0301.27524.1.24/sbin:/opt/cray/lustre-cray_ss_s/1.8.4_2.6.27.48_0.12.1_1.0301.5943.18.1-1.0301.27524.1.24/bin:/opt/cray/MySQL/5.0.64-1.0301.2899.20.1.ss/sbin:/opt/cray/MySQL/5.0.64-1.0301.2899.20.1.ss/bin:/opt/cray/sdb/1.0-1.0301.25929.4.88.ss/bin:/opt/cray/nodestat/2.2-1.0301.25918.4.1.ss/bin:/opt/modules/3.2.6.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:.:/opt/cray/bin
Can you please let me know how to resolve this error.

Thanks

Regards,
Vishal

Last edited by wyldckat; April 6, 2014 at 13:48. Reason: Added [CODE][/CODE]
nandiganavishal is offline   Reply With Quote

Old   April 6, 2014, 13:46
Default
  #13
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Vishal,

You should contact the administrator for the cluster you're using and/or read the instructions on their website. Because it seems that you're using a dedicated installation of OpenFOAM 2.1.1, which very likely will not work how we might expect, since we don't have access to the cluster you're using.

Because from your description, you seem to be confusing the path to your case "/lustre/scratch/joonho/openfoamv/conc_10mM/2D_simulations/PNP_solve/PNP_Foam" with the path to your application "PNPFoam".

My guess is that you should change your script to something like this:
Code:
#!/bin/bash
#PBS -A TG-CDA100010
#PBS -l size=72,walltime=00:02:00
#PBS -o a.out
#PBS -N  simout 

cd $PBS_O_WORKDIR

. /lustre/scratch/proj/sw/openfoam/2.1.1/cnl3.1_gnu4.6.2/OpenFOAM-2.1.1/etc/bashrc

aprun -n 72 -N 12 /full/path/to/your/PNPFoam -case /lustre/scratch/joonho/openfoamv/conc_10mM/2D_simulations/PNP_solve/PNP_Foam -parallel
Make sure to change the path "/full/path/to/your/PNPFoam" to the correct path for your solver. You can see its path if you build it again, as it's in the last 1 or 2 lines of the build process.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   April 21, 2015, 07:32
Default
  #14
Member
 
Sami
Join Date: Nov 2012
Location: Cap Town, South Africa
Posts: 87
Rep Power: 13
Mehrez is on a distinguished road
Thanks it works !

Quote:
Originally Posted by wyldckat View Post
Greetings mrv4real and welcome to the forum!

There are at least two ways for doing this:
  1. There is a script named "foamExec" that you can use to launch OpenFOAM applications. Run in your current terminal/console window the following command:
    Code:
    which foamExec
    Now, use that script for calling your desired solver or application. As an example, for running icoFoam in parallel in my machine, instead of simply using:
    Code:
    icoFoam -parallel
    I would use:
    Code:
    /home/me/OpenFOAM/OpenFOAM-2.0.x/bin/foamExec icoFoam -parallel
    This should work on all OpenFOAM versions, but sadly it doesn't always work, due to some bugs that existed on some versions.
  2. Or you can use a job file for the PBS, like the one shown here: http://www.cfd-online.com/Forums/ope...tml#post286124 - post #5
Best regards,
Bruno
Mehrez is offline   Reply With Quote

Old   November 18, 2015, 18:51
Default WM_PROJECT_DIR was the culprit in my case
  #15
Senior Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12
t.oliveira is on a distinguished road
I received the message "FOAM FATAL ERROR in Foam::findEtcFile() : could not find mandatory file 'controlDict'" when running splitMeshRegions from the command line, but it worked when called through a script. After comparing the environment variables in each situation and doing some test, I found out that the culprit was the variable WM_PROJECT_DIR.

Could anyone explain the relationship between the variable WM_PROJECT_DIR being wrongly set (it should points to where OpenFOAM is installed) and splitMeshRegions not finding the controlDict file (whose path is specific to the case I am working in)?

Thanks,
Thomas
t.oliveira is offline   Reply With Quote

Old   November 18, 2015, 19:00
Default WM_PROJECT_DIR was the culprit in my case
  #16
Senior Member
 
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12
t.oliveira is on a distinguished road
After some more tests, I realised that the mandatory file 'controlDict' which was not found didn't refer to the system/controlDict file of my specific case. Instead, it referred to the $WM_PROJECT_DIR/etc/controlDict file.

Now the relationship between the variable WM_PROJECT_DIR and the error message makes sense.

Regards,
Thomas

[EDIT: and now I noticed that wyldckat had already pointed out to this fact in September 3, 2011].
wht likes this.
t.oliveira 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
open_udf_library: The system cannot find the file John FLUENT 6 November 10, 2021 23:16
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
Regarding FoamX running Kindly help out hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 04:26
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51
open_udf_library: The system cannot find the file john CFX 1 February 13, 2005 00:21


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