1

i want to create a bigger application around OpenFoam, considering that the meshing is done with a Python api, i want to include the ./Allrun script into my Python files. First instict was to import os in python and insert the commands from the ./Allrun script. However i am only met with following error messages:

./Allrun: line 5: /bin/tools/RunFunctions: No such file or directory
--> FOAM FATAL ERROR :
    Could not find mandatory etc entry (mode=ugo)
    'controlDict'

--> FOAM FATAL ERROR :
    Could not find mandatory etc entry (mode=ugo)
    'controlDict'

This is the Python code:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
os.system("./Allrun")

and my ./Allrun script:


#!/bin/bash
cd ${0%/*} || exit 1    # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

gmshToFoam constant/pipeHex.msh
createPatch -overwrite

I suppose the problem is related to paths, but i don't have any idea how to resolve this.

Any help is appreciated!

Nico Su
  • 49
  • 4

1 Answers1

1

After some digging i found the solution myself. The inital instict, that the path was somehow realted to the problem turned out to be true. Adding

source /opt/openfoam9/etc/bashrc

did the trick.

Nico Su
  • 49
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 23 '22 at 16:56