Как запустить openfoam на ubuntu

Обновлено: 04.07.2024

OpenFOAM 8 is a major new release of OpenFOAM provided by the openfoam8 pack. It is accompanied by ParaView 5.6.0, compiled with the official OpenFOAM reader module, provided by the paraviewopenfoam56 pack. Both packs are available for the following versions of Ubuntu, 64 bit only:

  • 16.04 LTS, codename xenial
  • 18.04 LTS, codename bionic
  • 19.10, codename eoan
  • 20.04 LTS, codename focal

Installation

OpenFOAM and ParaView can be simply installed for the first time using the apt package management tool. The user will need to provide superuser password authentication when executing the following commands with sudo

OpenFOAM 8 and ParaView 5.6.0 are now installed in the /opt directory.

Patching OpenFOAM 8

OpenFOAM-8 is periodically recompiled into a new openfoam8 pack. The package will be upgraded automatically whenever repository package files are updated and the software is upgraded, e.g. by typing

Users can also specifically upgrade openfoam8 only by the following option:

Installation Problems

1. Networking must be enabled in order to be able to install software packages in Ubuntu. Installation failure due to networking problems usually results in an error message that reports failures in fetching archives and ends with a line like the following:

2. If ParaView shows a blank screen when Ubuntu is installed on a Virtual Machine, try using an alternative desktop such as Gnome Classic or MATE. To install Gnome Classic, type the following in a terminal window, then reboot and login using the Classic window manager:

3. A few users have encountered an error message similar to the following during installation (step 3):

The most likely cause of this error message is that the universe repositories are not enabled. To enable them, type the following in a terminal window:

4. If MPICH is installed on the system, then during user configuration (below), the following error message might occur when sourcing the etc/bashrc file in the OpenFOAM installation:

The user can check whether MPICH is installed by typing the following:

which returns /usr/mpich/include if MPICH is installed. This error is caused when the default mpicc is MPICH, rather than OpenMPI. The simplest way to fix the problem is to set mpicc to OpenMPI is by running the following command in a terminal prompt:

The .deb files for different versions of Ubuntu supplied can be downloaded directly from the OpenFOAM Download Repository.

User Configuration

In order to use the installed OpenFOAM package, complete the following:

  1. Open the .bashrc file in the user’s home directory in an editor, e.g. by typing in a terminal window (note the dot)
  2. At the bottom of that file, add the following line (see Note 1 below) and save the file
  3. Open a new terminal window (see Note 2 below) and test that the simpleFoam application, from the OpenFOAM package, is working by typing
  4. A “Usage” message should appear. Your installation and user configuration is complete.

Getting Started

Create a project directory within the $HOME/OpenFOAM directory named <USER>-8 (e.g. chris-8 for user chris and OpenFOAM version 8) and create a directory named run within it, e.g. by typing:

Copy across the backward facing step example, generate the mesh with blockMesh and run the steady flow, incompressible solver simpleFoam

Refer to the OpenFOAM User Guide to get started.

Reporting Bugs in OpenFOAM

We appreciate that bugs in OpenFOAM are reported so we can fix them. Please refer to the OpenFOAM Issue Tracking to report bugs.



OpenFOAM — свободно распространяемый инструментарий вычислительной гидродинамики для операций с полями (скалярными, векторными и тензорными). На сегодня является одним из «законченных» и известных приложений, предназначенных для FVM-вычислений.В частности пакет позволяет решать задачи гидродинамики ньютоновских и неньютоновских вязких жидкостей как в несжимаемом, так и сжимаемом приближении с учётом конвективного теплообмена и действием сил гравитации. Для моделирования турбулентных течений возможно использование RANS-моделей, LES- и DNS-методов. Возможно решение дозвуковых, околозвуковых и сверхзвуковых задач.

  • 12.04 LTS codename precise
  • 12.10 codename quantal
  • 13.04 codename raring
  • 13.10 codename saucy

Внимание процесс сборки может занять до 6 часов.

Найдите строку с GRUB_CMDLINE_LINUX_DEFAULT и дополните ее «video=hyperv_fb:1600x900». Где вместо 1600х900 подставьте разрешение вашего монитора. В моем случае она выглядела так.


Далее выполните обновление внесенных настроек командой

Изменения вступят после перезагрузки виртуальной машины.

Для сборки нам понадобится установить необходимые пакеты.

    Перейдите в режим root.

Следующие команды выполнят загрузку исходных кодов.

Так же исходники доступны тут

Разархивируем ThirdParty-2.3.0.tgz с помощью утилиты tar с ключами x распаковать z тип архива .gz f записать архив в файл (следующий параметр указывает имя файла). Следом удалим не нужный уже нам архив.

Вернемся в домашнюю директорию и установим переменные окружения.

В открывшемся текстовом редакторе, добавьте следующую строку в конец файла.

Сделаем доступными эти переменные окружения и протестируем одну из них.

Используя переменную окружения, перейдем в нужную директорию и выполним компиляцию.

Скомпилируем ParaView — постпроцессор для просмотра результатов и геометрий.

Заключительный шаг, выполнить компиляцию OpenFOAM ( Внимание эта операция самая продолжительная )

Осталось скопировать учебные задачи и проверить результат компиляции.

image

Если все хорошо у вас будет следующее на экране.

Выполним параллельный расчет мотоцикла.

После расчета, остается просмотреть что у нас получиться.


Отобразим только интересующий нас мотоцикл. Остальные галочки нужно убрать и оставить как на рисунке.

Нажмите Apply она будет зеленого цвета

image

Отобразим распределение давления. Выставив параметры в красном квадрате вы должны получить следующую картинку.

Надеюсь, данная инструкция поможет в работе начинающим пользователям OpenFOAM.

The openfoam-dev pack provides a packaged installation for Ubuntu of the current development line of OpenFOAM, known as OpenFOAM-dev, that contains the source code for the next major release of OpenFOAM. The pack is updated weekly to bring cutting-edge developments to users without them needing to compile source code. Updates can conveniently be installed as part of a standard update within the apt package management tool. The openfoam-dev pack works with the version of ParaView provided within the latest packaged version release of OpenFOAM — currently v7 ( openfoam7 ) which installs the paraviewopenfoam56 pack.

The openfoam-dev pack is available for the following versions of Ubuntu Linux 64bit only:

  • 18.04 LTS, codename bionic
  • 20.04 LTS, codename focal
  • 21.04, codename hirsute

The openfoam-dev pack was previously available for the following versions, but is no longer updated:

  • 14.04 LTS, codename trusty until April 2019.
  • 16.04 LTS, codename xenial , until June 2021.
  • 16.10, codename yakkety , until April 2017.
  • 17.04, codename zesty , retired at early end of life following the Meltdown and Spectre vulnerabilities.
  • 17.10, codename artful , until August 2018.
  • 18.10, codename cosmic , until July 2019.
  • 19.04, codename disco , until April 2020.
  • 19.10, codename eoan , until September 2020.
  • 20.10, codename groovy , until June 2021.

Installation

OpenFOAM-dev can be simply installed using the apt package management tool. The user will need to provide superuser password authentication when executing the following commands with sudo

OpenFOAM-dev is now installed in the /opt directory.

Installation Problems

Upgrading OpenFOAM-dev

Every week, OpenFOAM-dev is recompiled into a new openfoam-dev pack within the dev repository. The package will be upgraded automatically whenever repository package files are updated and the software is upgraded, e.g. by typing

Users can also specifically upgrade openfoam-dev only by the following option:

User Configuration

In order to use the installed OpenFOAM package, complete the following

  1. Open the .bashrc file in the user’s home directory in an editor, e.g. by typing in a terminal window (note the dot)
  2. At the bottom of that file, add the following line (see Note 1 below) and save the file
  3. Open a new terminal window (see Note 2 below) and test that the simpleFoam application, from the OpenFOAM package, is working by typing
  4. A “Usage” message should appear. Your installation and user configuration is complete.

Getting Started

Create a project directory within the $HOME/OpenFOAM directory named <USER>-dev (e.g. chris-dev for user chris ) and create a directory named run within it, e.g. by typing:

Copy across the backward facing step example, generate the mesh with blockMesh and run the steady flow, incompressible solver simpleFoam

Refer to the OpenFOAM User Guide to get started.

Reporting Bugs in OpenFOAM

We appreciate that bugs in OpenFOAM are reported so we can fix them. Please refer to the OpenFOAM Issue Tracking to report bugs.

OpenFOAM 9 is a major new release of OpenFOAM provided by the openfoam9 pack. It is accompanied by ParaView 5.6.3, compiled with the official OpenFOAM reader module, provided by the paraviewopenfoam56 pack. Both packs are available for the following versions of Ubuntu:

  • 18.04 LTS, codename bionic
  • 20.04 LTS, codename focal
  • 21.04, codename hirsute

Installation

OpenFOAM and ParaView can be simply installed for the first time using the apt package management tool. The user will need to provide superuser password authentication when executing the following commands with sudo

OpenFOAM 9 and ParaView 5.6.3 are now installed in the /opt directory.

Patching OpenFOAM 9

OpenFOAM-9 is periodically recompiled into a new openfoam9 pack. The package will be upgraded automatically whenever repository package files are updated and the software is upgraded, e.g. by typing

Users can also specifically upgrade openfoam9 only by the following option:

Installation Problems

1. Networking must be enabled in order to be able to install software packages in Ubuntu. Installation failure due to networking problems usually results in an error message that reports failures in fetching archives and ends with a line like the following:

2. If ParaView shows a blank screen when Ubuntu is installed on a Virtual Machine, try using an alternative desktop such as Gnome Classic or MATE. To install Gnome Classic, type the following in a terminal window, then reboot and login using the Classic window manager:

3. A few users have encountered an error message similar to the following during installation (step 3):

The most likely cause of this error message is that the universe repositories are not enabled. To enable them, type the following in a terminal window:

4. If MPICH is installed on the system, then during user configuration (below), the following error message might occur when sourcing the etc/bashrc file in the OpenFOAM installation:

The user can check whether MPICH is installed by typing the following:

which returns /usr/mpich/include if MPICH is installed. This error is caused when the default mpicc is MPICH, rather than OpenMPI. The simplest way to fix the problem is to set mpicc to OpenMPI is by running the following command in a terminal prompt:

The .deb files for different versions of Ubuntu supplied can be downloaded directly from the OpenFOAM Download Repository.

User Configuration

In order to use the installed OpenFOAM package, complete the following:

  1. Open the .bashrc file in the user’s home directory in an editor, e.g. by typing in a terminal window (note the dot)
  2. At the bottom of that file, add the following line (see Note 1 below) and save the file
  3. Open a new terminal window (see Note 2 below) and test that the simpleFoam application, from the OpenFOAM package, is working by typing
  4. A “Usage” message should appear. Your installation and user configuration is complete.

Getting Started

Create a project directory within the $HOME/OpenFOAM directory named <USER>-9 (e.g. chris-9 for user chris and OpenFOAM version 9) and create a directory named run within it, e.g. by typing:

Copy across the backward facing step example, generate the mesh with blockMesh and run the steady flow, incompressible solver simpleFoam

Refer to the OpenFOAM User Guide to get started.

Reporting Bugs in OpenFOAM

We appreciate that bugs in OpenFOAM are reported so we can fix them. Please refer to the OpenFOAM Issue Tracking to report bugs.

Читайте также: