Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 380
    • Issues 380
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Wiki
  • running

Last edited by Mark Olesen Dec 17, 2021
Page history

running

home

Once OpenFOAM has been built and installed, running it requires a properly defined environment prior to executing any applications or solvers. For a runtime environment, the absolute minimum is the following:

Enviroment Use
WM_PROJECT_DIR The installation location of OpenFOAM
PATH Must include platforms-specific OpenFOAM bin directory
LD_LIBRARY_PATH Must include platforms-specific OpenFOAM lib directory, and MPI library variants

There are various ways to setup a minimum or fuller environment. Which one you choose is largely personal preference and depends on how much flexibility or permanence is desired.

  • Transient (one-time) use
    • Shell session
    • Manually
  • Persistent selection
    • openfoam-selector
    • Manual

Transient (one-time) use

In many cases it is desirable to activate or use a particular OpenFOAM version without any additional setup.

bash Shell session

Depending on your packaging system (or system administrator), an OpenFOAM shell session command may be available as a convenient means of defining and using an OpenFOAM environment. For example,

# Interactive shell
$ openfoam

The shell session can be particularly useful when running a single OpenFOAM application from within a workflow. For example,

# Use an older version
$ openfoam2012 simpleFoam

Manually

To manually activate a particular OpenFOAM version, source its corresponding etc/bashrc file:

$ . /path/to/openfoam/etc/bashrc

After using the desired OpenFOAM commands, the wmUnset alias can be used to remove it again.

NOTE: The /path/to/openfoam location will depend on the OpenFOAM version and installation.

Persistent selection

openfoam-selector

Depending on your packaging system (or system administrator), an openfoam-selector may be available to define the preferred OpenFOAM version for the login shell.

Manual

For a persistent OpenFOAM environment, the OpenFOAM bashrc file can be sourced from your ~/.bashrc file by adding a line resembling the following to that file:

. /path/to/openfoam/etc/bashrc

It is usually prudent to check the existence of the file prior to sourcing it:

if [ -f /path/to/openfoam/etc/bashrc ]
then  . /path/to/openfoam/etc/bashrc
fi

NOTE: The /path/to/openfoam location will depend on the OpenFOAM version and installation.


Copyright (C) 2019-2021 OpenCFD Ltd.

Clone repository
  • Submitting issues
  • building
  • building
    • cross compile mingw
  • coding
    • git workflow
    • patterns
      • HashTable
      • dictionary
      • memory
      • patterns
      • precision
      • selectors
      • strings
    • style
      • style
  • configuring
  • Home
  • icons
    • info
View All Pages