|
[Sponsors] |
October 20, 2022, 09:14 |
Running OpenFoam with Python
|
#1 |
Senior Member
Nico
Join Date: Jan 2022
Location: Germany
Posts: 122
Rep Power: 6 |
Hey,
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: Code:
./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' Code:
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os os.system("./Allrun") Code:
#!/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! |
|
October 20, 2022, 10:38 |
|
#2 |
Senior Member
Nico
Join Date: Jan 2022
Location: Germany
Posts: 122
Rep Power: 6 |
It really had to do with paths, or rahter the right source.
If somebody is trying to do the same: Code:
import subprocess subprocess.call("./Allrun",shell=True) Code:
#!/bin/bash source /opt/openfoam9/etc/bashrc |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to contribute to the community of OpenFOAM users and to the OpenFOAM technology | wyldckat | OpenFOAM | 17 | November 10, 2017 16:54 |
OpenFOAM v3.0+ ?? | SBusch | OpenFOAM | 22 | December 26, 2016 15:24 |
[OpenFOAM.org] A Mac OS X of23x Development Environment Using Docker | rt08 | OpenFOAM Installation | 1 | February 28, 2016 20:00 |
Python for openfoam | Divyaprakash | OpenFOAM Programming & Development | 1 | August 22, 2014 10:05 |
Statically Compiling OpenFOAM Issues | herzfeldd | OpenFOAM Installation | 21 | January 6, 2009 10:38 |