Skip to content

Write on a wiki page about how to call OpenFOAM/blueCFD-Core applications from an external application/GUI #94

@wyldckat

Description

@wyldckat

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:

  1. 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.

  2. 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's QProcess there is a method for exactly that.

  3. 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
    

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions