-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Since this topic was finally asked publicly at https://www.cfd-online.com/Forums/openfoam-programming-development/200289-how-call-bluecfd-pass-arguments-external-programs.html - here is a quick run down of how to launch OpenFOAM applications (as provided by blueCFD-Core on Windows) from an external application, may it be a GUI or some optimization application.
There are a few possible ways this can be done:
-
The simplest is to simply launch the external application from within the blueCFD-Core (MSys2) terminal or from within the Windows Command Line (called from the file
DOS_mode.bat), which will allow to already have the shell environment pre-loaded with the necessary paths. -
The next possibility is to hard-code the environment variables that are provided in the file
setvars.bat, which is provided as of blueCFD-Core 2016-2. This means that your external application will have to set the environment variables through whichever process launching mechanism you are using. For example, on Qt'sQProcessthere is a method for exactly that. -
The other possibility is to generate a batch file inside the case folder, which you call from within your application, via
cmd.exe. Said batch file would then need something like this:cd "C:\Program Files\blueCFD-Core-2017" call setvars.bat set PATH=%HOME%\msys64\usr\bin;%PATH% cd "FULL PATH TO YOUR CASE FOLDER" YOUR COMMANDS HERE